function revisioning_menu_alter in Revisioning 6.4
Same name and namespace in other branches
- 8 revisioning.module \revisioning_menu_alter()
- 6 revisioning.module \revisioning_menu_alter()
- 6.3 revisioning.module \revisioning_menu_alter()
- 7 revisioning.module \revisioning_menu_alter()
Implementation of hook_menu_alter().
Modify menu items defined in other modules (in particular the Node and Module Grants modules).
File
- ./
revisioning.module, line 265 - Allows the creation and modification of pre-published as well as live content while the current revision remains unchanged and publicly visible until the changes have been reviewed by a moderator.
Code
function revisioning_menu_alter(&$items) {
// Primary tabs for 'node/%node': View tab, Edit tab, Revisions tab ...
// View tab can be either 'View current' or 'View latest'.
// It should be suppressed when the 'Revisions' tab shows the same revision,
// so we need a special access callback for this, which expands on the
// callback defined in Module Grants.
$items['node/%node']['access callback'] = $items['node/%node/view']['access callback'] = '_revisioning_view_edit_access_callback';
$items['node/%node']['access arguments'] = $items['node/%node/view']['access arguments'] = array(
'view',
1,
);
$items['node/%node']['page callback'] = $items['node/%node/view']['page callback'] = '_revisioning_view';
$items['node/%node']['page arguments'] = $items['node/%node/view']['page arguments'] = array(
1,
);
$items['node/%node']['title callback'] = $items['node/%node/view']['title callback'] = '_revisioning_title_for_tab';
$items['node/%node']['title arguments'] = $items['node/%node/view']['title arguments'] = array(
1,
FALSE,
);
// Edit tab can be either 'Edit current' or 'Edit latest'.
// It should be suppressed when the 'Revisions' tab shows the same revision,
// so we need a special access callback for this, which expands on the
// callback defined in Module Grants.
$items['node/%node/edit']['access callback'] = '_revisioning_view_edit_access_callback';
$items['node/%node/edit']['access arguments'] = array(
'edit',
1,
);
$items['node/%node/edit']['page callback'] = '_revisioning_edit';
$items['node/%node/edit']['title callback'] = '_revisioning_title_for_tab';
$items['node/%node/edit']['title arguments'] = array(
1,
TRUE,
);
// 'Revisions' tab remains but points to new page callback, allowing users to
// pick the revision to view, edit, publish, revert, unpublish, delete.
// Need to override _node_revision_access() call back as it disallows access
// to the 'Revisions' tab when there's only one revision, which will prevent
// users from getting to the publish/unpublish links.
$items['node/%node/revisions']['access callback'] = '_revisioning_node_revision_access';
$items['node/%node/revisions']['access arguments'] = array(
'view revision list',
1,
);
$items['node/%node/revisions']['page callback'] = '_revisioning_present_node';
$items['node/%node/revisions']['page arguments'] = array(
1,
);
// Unset old menu items defined in node.module, as these are replaced by
// ones that use the %vid wildcard instead of % and have proper callbacks.
unset($items['node/%node/revisions/%/view']);
unset($items['node/%node/revisions/%/revert']);
unset($items['node/%node/revisions/%/delete']);
if (module_exists('diff')) {
// If Diff module is enabled, make sure it uses correct access callback
$items['node/%node/revisions/view/%/%']['access callback'] = '_revisioning_node_revision_access';
$items['node/%node/revisions/view/%/%']['access arguments'] = array(
'view revisions',
1,
);
}
// This is here rather than in revisioning_menu() as Diff may redefine
// the node/%node/revisions/list item.
$items['node/%node/revisions/list'] = array(
'title' => 'List all revisions',
'access callback' => '_revisioning_node_revision_access',
'access arguments' => array(
'view revision list',
1,
),
'file' => 'node.pages.inc',
'module' => 'node',
//'file path' => drupal_get_path('module', 'node'),
'type' => MENU_LOCAL_TASK,
// was: MENU_DEFAULT_LOCAL_TASK; changed for Smart tabs
'weight' => -20,
);
// Apart from administrators, allow those that pass the 'trigger_access_check'
// to configure the revisioning triggers. This means that users must have at
// least 'administer actions' and 'access administration pages' (the latter is
// to allow them to navigate to the trigger page via the menu).
if (module_exists('trigger')) {
$items['admin/build/trigger/revisioning']['access callback'] = 'trigger_access_check';
}
}