You are here

function diff_menu in Diff 5

Same name and namespace in other branches
  1. 5.2 diff.module \diff_menu()
  2. 6.2 diff.module \diff_menu()
  3. 6 diff.module \diff_menu()
  4. 7.3 diff.module \diff_menu()
  5. 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,
        );
      }
    }
  }
  return $items;
}