You are here

function _revisioning_block_pending_revisions_content in Revisioning 8

Same name and namespace in other branches
  1. 7 revisioning.pages.inc \_revisioning_block_pending_revisions_content()

Define content for pending revisions block.

Parameters

array $revisions: array of revision objects

Return value

array the block array

1 call to _revisioning_block_pending_revisions_content()
revisioning_block_view in ./revisioning.pages.inc
Implements hook_block_view().

File

./revisioning.pages.inc, line 431
Rendering and altering of pages and forms used by Revisioning.

Code

function _revisioning_block_pending_revisions_content($revisions) {
  $num_revisions = count($revisions);
  $max_num_shown = variable_get('revisioning_block_num_pending', 5);
  $links = array();
  foreach (array_slice($revisions, 0, $max_num_shown) as $revision) {

    // If they exist, should we show multiple pending revisions on same node?
    $links[] = l($revision->title, "node/{$revision->nid}/revisions/{$revision->vid}/view");
  }

  // Also loads /revisioning-rtl.css
  drupal_add_css(drupal_get_path('module', 'revisioning') . '/revisioning.css');
  $title_link = trim(variable_get('revisioning_content_summary_page', ''));
  $link_options = array();
  if (empty($title_link)) {
    if (module_exists('views')) {
      $title_link = 'content-summary';
      $link_options['query'] = array(
        'revision_moderation' => 1,
        'state' => 2,
      );
    }
    elseif (user_access('access content overview')) {
      $title_link = 'admin/content';
    }
  }
  $title = t('!num_revisions pending', array(
    '!num_revisions' => format_plural($num_revisions, '1 revision', '@count revisions'),
  ));
  $block = array();
  $block['subject'] = empty($title_link) ? $title : l($title, $title_link, $link_options);
  $block['content'] = theme('item_list', array(
    'items' => $links,
    'title' => '',
  ));
  return $block;
}