function diff_menu in Diff 5.2
Same name and namespace in other branches
- 5 diff.module \diff_menu()
- 6.2 diff.module \diff_menu()
- 6 diff.module \diff_menu()
- 7.3 diff.module \diff_menu()
- 7.2 diff.module \diff_menu()
Implementation of hook_menu() The menu path 'node/$nid/revisions' is overriden with 'diff_diffs'.
File
- ./
diff.module, line 38
Code
function diff_menu($may_cache) {
$items = array();
if (!$may_cache) {
if (arg(0) == 'node' && is_numeric(arg(1))) {
$node = node_load(arg(1));
if ($node->nid) {
$revisions_access = (user_access('view revisions') || user_access('administer nodes')) && node_access('view', $node) && db_result(db_query('SELECT COUNT(vid) FROM {node_revisions} WHERE nid = %d', arg(1))) > 1;
$items[] = array(
'path' => 'node/' . arg(1) . '/revisions',
'title' => t('Revisions'),
'callback' => 'diff_diffs',
'access' => $revisions_access,
'weight' => 4,
'type' => MENU_LOCAL_TASK,
);
$items[] = array(
'path' => 'node/' . arg(1) . '/revisions/view/latest',
'title' => t('Revisions'),
'callback' => 'diff_latest',
'callback arguments' => array(
arg(1),
),
'access' => $revisions_access,
'type' => MENU_CALLBACK,
);
}
}
}
return $items;
}