function diff_menu in Diff 7.2
Same name and namespace in other branches
- 5.2 diff.module \diff_menu()
- 5 diff.module \diff_menu()
- 6.2 diff.module \diff_menu()
- 6 diff.module \diff_menu()
- 7.3 diff.module \diff_menu()
Implements hook_menu().
File
- ./
diff.module, line 32 - Provides functionality to show a diff between two node revisions.
Code
function diff_menu() {
$items = array();
/**
* By using MENU_LOCAL_TASK (and 'tab_parent') we can get the various revision-views to
* show the View|Edit|Revision-tabs of the node on top, and have the Revisions-tab open.
* To avoid creating/showing any extra tabs or sub-tabs (tasks below top level) for the
* various paths (i.e. "Diff", "Show latest" and "Show a specific revision") that need
* a revision-id (vid) parameter, we make sure to set 'tab_parent' a bit odd.
* This solution may not be the prettiest one, but by avoiding having two _LOCAL_TASKs
* sharing a parent that can be accessed by its full path, it seems to work as desired.
* Breadcrumbs work decently, at least the node link is among the crumbs. For some reason
* any breadcrumbs "before/above" the node is only seen at 'node/%node/revisions/%/view'.
*/
$items['node/%node/revisions/list'] = array(
// Not used directly, but was created to get the other menu items to work well
'title' => 'List revisions',
'page callback' => 'diff_diffs_overview',
'type' => MENU_DEFAULT_LOCAL_TASK,
'access callback' => 'diff_node_revision_access',
'access arguments' => array(
1,
),
'file' => 'diff.pages.inc',
);
$items['node/%node/revisions/view'] = array(
'title' => 'Diff',
'page callback' => 'diff_diffs_show',
'page arguments' => array(
1,
4,
5,
6,
),
'type' => MENU_LOCAL_TASK,
'access callback' => 'diff_node_revision_access',
'access arguments' => array(
1,
),
'tab_parent' => 'node/%/revisions/list',
'file' => 'diff.pages.inc',
);
$items['node/%node/revisions/view/latest'] = array(
'title' => 'Show latest diff',
'page callback' => 'diff_latest',
'page arguments' => array(
1,
),
'type' => MENU_LOCAL_TASK,
'access callback' => 'diff_node_revision_access',
'access arguments' => array(
1,
),
'tab_parent' => 'node/%/revisions/view',
'file' => 'diff.pages.inc',
);
return $items;
}