function theme_node_recent_block

Returns HTML for a list of recent content.

Parameters

$variables: An associative array containing:

  • nodes: An array of recent node entities.

Related topics

1 theme call to theme_node_recent_block()
RecentContentBlock::build in drupal/core/modules/node/lib/Drupal/node/Plugin/Block/RecentContentBlock.php
Builds and returns the renderable array for this block plugin.

File

drupal/core/modules/node/node.module, line 1875
The core module that allows content to be submitted to the site.

Code

function theme_node_recent_block($variables) {
  $rows = array();
  $output = '';
  $l_options = array(
    'query' => drupal_get_destination(),
  );
  foreach ($variables['nodes'] as $node) {
    $row = array();
    $node_recent_content = array(
      '#theme' => 'node_recent_content',
      '#node' => $node,
    );
    $row[] = array(
      'data' => drupal_render($node_recent_content),
      'class' => 'title-author',
    );
    if (node_access('update', $node)) {
      $row[] = array(
        'data' => l(t('edit'), 'node/' . $node->nid . '/edit', $l_options),
        'class' => 'edit',
      );
    }
    if (node_access('delete', $node)) {
      $row[] = array(
        'data' => l(t('delete'), 'node/' . $node->nid . '/delete', $l_options),
        'class' => 'delete',
      );
    }
    $rows[] = $row;
  }
  if ($rows) {
    $table = array(
      '#theme' => 'table',
      '#rows' => $rows,
    );
    $output = drupal_render($table);
    if (user_access('access content overview')) {
      $more_link = array(
        '#theme' => 'more_link',
        '#url' => 'admin/content',
        '#title' => t('Show more content'),
      );
      $output .= drupal_render($more_link);
    }
  }
  return $output;
}