You are here

function workbench_moderation_menu_alter in Workbench Moderation 7.2

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

Implements hook_menu_alter().

File

./workbench_moderation.module, line 88
workbench_moderation.module

Code

function workbench_moderation_menu_alter(&$items) {

  // Hide Workflow tab provided by State Flow.
  $items['node/%node/workflow']['access callback'] = FALSE;

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

  // 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';
  $items['node/%node/revisions/%/view']['access callback'] = 'workbench_moderation_revision_access';

  // Use our access control for the entity_translation path handling if set.
  if (isset($items['node/%node/revisions/%state_flow_revision_node'])) {
    $items['node/%node/revisions/%state_flow_revision_node']['access callback'] = 'workbench_moderation_revision_access';
  }

  // Redirect node/%node/workflow
  if (!empty($items['node/%node/workflow']) && $items['node/%node/workflow']['module'] === 'state_flow') {

    // @todo, Uncomment this when the moderation tab is ready.
    // $items['node/%node/workflow']['page callback'] = 'workbench_moderation_node_revisions_redirect';
    // $items['node/%node/workflow']['page arguments'] = array(1);
    // $items['node/%node/workflow']['type'] = MENU_NORMAL_ITEM;
  }

  /**
  * @todo, revisit these alters from version 1.x. See link below:
  * @see https://www.drupal.org/node/1279290
    // 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/%/delete']['access callback'] = '_workbench_moderation_revision_access';

    // 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'),
   );
    }
  *
  *
  */
}