function revisioning_menu in Revisioning 6.4
Same name and namespace in other branches
- 8 revisioning.module \revisioning_menu()
- 6 revisioning.module \revisioning_menu()
- 6.3 revisioning.module \revisioning_menu()
- 7 revisioning.module \revisioning_menu()
Implementation of hook_menu().
Define new menu items. Existing menu items are modified through hook_menu_alter().
File
- ./
revisioning.module, line 82 - 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() {
$items = array();
if (module_exists('module_grants_monitor')) {
// Add a tab to the 'I created' tab (defined in module_grants_monitor.module)
$items['accessible-content/i-created/pending'] = array(
'title' => 'In draft/Pending publication',
'page callback' => '_revisioning_show_pending_nodes',
'page arguments' => array(
'view',
I_CREATED,
),
'access callback' => 'revisioning_user_all_access',
'access arguments' => array(
array(
'access I Created tab',
'access Pending tab',
),
),
'type' => MENU_LOCAL_TASK,
'weight' => -1,
);
// Add a tab to the 'I last modified' tab
$items['accessible-content/i-last-modified/pending'] = array(
'title' => 'In draft/Pending publication',
'page callback' => '_revisioning_show_pending_nodes',
'page arguments' => array(
'view',
I_LAST_MODIFIED,
),
'access callback' => 'revisioning_user_all_access',
'access arguments' => array(
array(
'access I Last Modified tab',
'access Pending tab',
),
),
'type' => MENU_LOCAL_TASK,
'weight' => -1,
);
// Add a tab to the 'I can edit' tab
$items['accessible-content/i-can-edit/pending'] = array(
'title' => 'In draft/Pending publication',
'page callback' => '_revisioning_show_pending_nodes',
'page arguments' => array(
'update',
),
'access callback' => 'revisioning_user_all_access',
'access arguments' => array(
array(
'access I Can Edit tab',
'access Pending tab',
),
),
'type' => MENU_LOCAL_TASK,
'weight' => -1,
);
// Add a tab to the 'I can view' tab (defined in module_grants.module)
$items['accessible-content/i-can-view/pending'] = array(
'title' => 'In draft/Pending publication',
'page callback' => '_revisioning_show_pending_nodes',
'page arguments' => array(
'view',
),
'access callback' => 'revisioning_user_all_access',
'access arguments' => array(
array(
'access I Can View tab',
'access Pending tab',
),
),
'type' => MENU_LOCAL_TASK,
'weight' => -1,
);
}
// Callback (not a tab) to allow users to unpublish a node.
// Note that is a node operation more so than a revision operation, but
// we let _revisioning_node_revision_access() handle access anyway.
$items['node/%node/unpublish'] = array(
//'title' => t(Unpublish current revision'),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'revisioning_unpublish_confirm',
1,
),
'access callback' => '_revisioning_node_revision_access',
// _revisioning_node_access ?
'access arguments' => array(
'unpublish current revision',
1,
),
'type' => MENU_CALLBACK,
);
// Revision tab local subtasks (i.e. secondary tabs), up to 7 of them:
// view, edit, publish, unpublish, revert, delete and compare.
// All revision operations 'node/%node/revisions/%vid/<op>' are defined as
// local tasks (tabs) secondary to the primary 'node/%node/revisions' local
// task (tab).
// The tricky part is to always set "tab_parent", core does NOT figure this
// out based on the URL. %vid is optional, see vid_to_arg().
// Note: the MENU_DEFAULT_LOCAL_TASK for 'node/%node/revisions' is defined in
// function revisioning_menu_alter()
// View revision local subtask
$items['node/%node/revisions/%vid/view'] = array(
'title' => 'View',
'load arguments' => array(
3,
),
'page callback' => '_revisioning_view_revision',
'page arguments' => array(
1,
),
'access callback' => '_revisioning_node_revision_access',
'access arguments' => array(
'view revisions',
1,
),
'type' => MENU_LOCAL_TASK,
'weight' => -10,
'tab_parent' => 'node/%/revisions',
);
// Edit revision local subtask
$items['node/%node/revisions/%vid/edit'] = array(
'title' => 'Edit',
'load arguments' => array(
3,
),
'page callback' => '_revisioning_edit_revision',
'page arguments' => array(
1,
),
'access callback' => '_revisioning_node_revision_access',
'access arguments' => array(
'edit revisions',
1,
),
'file' => 'node.pages.inc',
'file path' => drupal_get_path('module', 'node'),
'type' => MENU_LOCAL_TASK,
'weight' => -7,
'tab_parent' => 'node/%/revisions',
);
// Publish revision local subtask
$items['node/%node/revisions/%vid/publish'] = array(
'title' => 'Publish this',
'load arguments' => array(
3,
),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'revisioning_publish_confirm',
1,
),
'access callback' => '_revisioning_node_revision_access',
'access arguments' => array(
'publish revisions',
1,
),
'type' => MENU_LOCAL_TASK,
'weight' => -4,
'tab_parent' => 'node/%/revisions',
);
// Unpublish node local subtask
$items['node/%node/revisions/%vid/unpublish'] = array(
'title' => 'Unpublish this',
'load arguments' => array(
3,
),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'revisioning_unpublish_confirm',
1,
),
'access callback' => '_revisioning_node_revision_access',
'access arguments' => array(
'unpublish current revision',
1,
),
'type' => MENU_LOCAL_TASK,
'weight' => -3,
'tab_parent' => 'node/%/revisions',
);
// Revert to revision local subtask.
// Difference from core version is %vid that's served by vid_to_arg() function.
$items['node/%node/revisions/%vid/revert'] = array(
'title' => 'Revert to this',
'load arguments' => array(
3,
),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'node_revision_revert_confirm',
1,
),
'access callback' => '_revisioning_node_revision_access',
'access arguments' => array(
'revert revisions',
1,
),
'file' => 'node.pages.inc',
'file path' => drupal_get_path('module', 'node'),
'type' => MENU_LOCAL_TASK,
'weight' => -2,
'tab_parent' => 'node/%/revisions',
);
// Delete revision local subtask.
// Difference from core version is %vid that's served by vid_to_arg() function.
$items['node/%node/revisions/%vid/delete'] = array(
'title' => 'Delete',
'load arguments' => array(
3,
),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'node_revision_delete_confirm',
1,
),
'access callback' => '_revisioning_node_revision_access',
'access arguments' => array(
'delete revisions',
1,
),
'file' => 'node.pages.inc',
'file path' => drupal_get_path('module', 'node'),
'type' => MENU_LOCAL_TASK,
'weight' => 10,
'tab_parent' => 'node/%/revisions',
);
// If Diff module is enabled, provide a compare local subtask
if (module_exists('diff')) {
$items['node/%node/revisions/%vid/compare'] = array(
'title' => 'Compare to current',
'load arguments' => array(
3,
),
'page callback' => '_revisioning_compare_to_current_revision',
'page arguments' => array(
1,
),
'access callback' => '_revisioning_node_revision_access',
'access arguments' => array(
'compare to current',
1,
),
'type' => MENU_LOCAL_TASK,
'weight' => 0,
'tab_parent' => 'node/%/revisions',
);
}
// Finally, the Revisioning configuration menu item
$items['admin/settings/revisioning'] = array(
'title' => 'Revisioning',
'description' => 'Configure how links to view and edit content behave.',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'revisioning_admin_configure',
),
'access arguments' => array(
'administer site configuration',
),
'file' => 'revisioning.admin.inc',
);
return $items;
}