You are here

function revisioning_ux_page_alter in Revisioning 8

Same name and namespace in other branches
  1. 7 revisioning_ux/revisioning_ux.module \revisioning_ux_page_alter()

Implements hook_page_alter().

File

revisioning_ux/revisioning_ux.module, line 62
Revisioning User Experience Adjustments

Code

function revisioning_ux_page_alter(&$page) {
  if (isset($page['content']['system_main']['#form_id']) && $page['content']['system_main']['#form_id'] == 'revisioning_revisions_summary') {
    $node = node_load($page['content']['system_main']['nid']['#value']);
    $page['content']['buttons']['#prefix'] = '<div class="revisioning-ux-buttons">';
    $page['content']['buttons']['#suffix'] = '</div>';
    if (!empty($node->revision_moderation)) {
      if (_revisioning_access_node_revision('publish revisions', $node)) {
        $page['content']['buttons']['publish'] = drupal_get_form('revisioning_ux_publish', $node);
      }
      elseif (_revisioning_access_node_revision('unpublish current revision', $node)) {
        $page['content']['buttons']['unpublish'] = drupal_get_form('revisioning_ux_unpublish', $node);
      }
    }
    if (_revisioning_access_node_revision('delete archived revisions', $node)) {
      $num_archived = revisioning_get_number_of_archived_revisions($node);
      if ($num_archived > 0) {
        $page['content']['buttons']['delete-archived'] = drupal_get_form('revisioning_ux_delete_archived', $node);
      }
    }
    if (_revisioning_access_node_revision('delete node', $node)) {
      $page['content']['buttons']['delete-all'] = drupal_get_form('revisioning_ux_delete_all', $node);
    }
  }
}