You are here

function revisioning_menu_alter in Revisioning 6

Same name and namespace in other branches
  1. 8 revisioning.module \revisioning_menu_alter()
  2. 6.4 revisioning.module \revisioning_menu_alter()
  3. 6.3 revisioning.module \revisioning_menu_alter()
  4. 7 revisioning.module \revisioning_menu_alter()

Implementation of hook_menu_alter().

Modify menu items defined in other modules (in particular the Module Grants module).

File

./revisioning.module, line 81

Code

function revisioning_menu_alter(&$items) {

  // Change 'My content' default tab from Editable to Pending
  $items['content']['page callback'] = 'revisioning_pending_nodes';
  $items['content/editable']['type'] = MENU_LOCAL_TASK;
  $items['content/pending']['type'] = MENU_DEFAULT_LOCAL_TASK;

  // Rename "View" tab
  $items['node/%node/view']['title'] = 'View current';

  // Remove "Edit" as a tab and redirect existing edit links to
  // revisioning_node_revisions() to ensure user picks desired revision first.
  $items['node/%node/edit']['page callback'] = 'revisioning_node_revisions';
  $items['node/%node/edit']['page arguments'] = array(
    1,
  );
  $items['node/%node/edit']['type'] = MENU_CALLBACK;
  if (!module_exists("diff")) {

    // "Revisions" tab remains but points to new page callback, which ensures users
    // pick the desired revision to view, edit, publish, revert, unpublish, delete.
    $items['node/%node/revisions']['page callback'] = 'revisioning_node_revisions';
    $items['node/%node/revisions']['page arguments'] = array(
      1,
    );
  }

  // Point /%node/revisions/%/view page to same callback as /%node/view for a
  // consistent view of current and other revisions
  $items['node/%node/revisions/%/view']['page callback'] = 'node_page_view';

  // as used by /%node/view
  $items['node/%node/revisions/%/view']['page arguments'] = array(
    1,
  );

  // Override existing callback to insert trigger, pulled upon reverting
  $items['node/%node/revisions/%/revert']['page callback'] = 'drupal_get_form';
  $items['node/%node/revisions/%/revert']['page arguments'] = array(
    'revisioning_revert_confirm',
    1,
  );
}