You are here

function workbench_moderation_menu_alter in Workbench Moderation 7

Same name and namespace in other branches
  1. 7.3 workbench_moderation.module \workbench_moderation_menu_alter()
  2. 7.2 workbench_moderation.module \workbench_moderation_menu_alter()

Implements hook_menu_alter().

File

./workbench_moderation.module, line 172
Content moderation for Workbench.

Code

function workbench_moderation_menu_alter(&$items) {

  // Hijack the node/X/edit page to ensure that the right revision (most current) is displayed.
  $items['node/%node/edit']['page callback'] = 'workbench_moderation_node_edit_page_override';

  // Override the node edit menu item title.
  $items['node/%node/edit']['title callback'] = 'workbench_moderation_edit_tab_title';
  $items['node/%node/edit']['title arguments'] = array(
    1,
  );

  // Override the node view menu item title.
  $items['node/%node/view']['title callback'] = 'workbench_moderation_view_tab_title';
  $items['node/%node/view']['title arguments'] = array(
    1,
  );

  // Redirect node/%node/revisions
  $items['node/%node/revisions']['page callback'] = 'workbench_moderation_node_revisions_redirect';
  $items['node/%node/revisions']['page arguments'] = array(
    1,
  );

  // Override the node revision view callback.
  $items['node/%node/revisions/%/view']['page callback'] = 'workbench_moderation_node_view_revision';
  $items['node/%node/revisions/%/view']['file path'] = drupal_get_path('module', 'workbench_moderation');
  $items['node/%node/revisions/%/view']['file'] = 'workbench_moderation.node.inc';

  // For revert and delete operations, use our own access check.
  $items['node/%node/revisions/%/revert']['access callback'] = '_workbench_moderation_revision_access';
  $items['node/%node/revisions/%/revert']['access arguments'] = array(
    1,
    'update',
  );
  $items['node/%node/revisions/%/delete']['access callback'] = '_workbench_moderation_revision_access';
  $items['node/%node/revisions/%/delete']['access arguments'] = array(
    1,
    'delete',
  );

  // Provide a container administration menu item, if one doesn't already exist.
  if (!isset($items['admin/config/workbench'])) {
    $items['admin/config/workbench'] = array(
      'title' => 'Workbench',
      'description' => 'Workbench',
      'page callback' => 'system_admin_menu_block_page',
      'access arguments' => array(
        'administer site configuration',
      ),
      'position' => 'right',
      'file' => 'system.admin.inc',
      'file path' => drupal_get_path('module', 'system'),
    );
  }
}