You are here

function node_menu in Drupal 4

Same name and namespace in other branches
  1. 5 modules/node/node.module \node_menu()
  2. 6 modules/node/node.module \node_menu()
  3. 7 modules/node/node.module \node_menu()

Implementation of hook_menu().

File

modules/node.module, line 839
The core that allows content to be submitted to the site.

Code

function node_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/node',
      'title' => t('content'),
      'callback' => 'node_admin_nodes',
      'access' => user_access('administer nodes'),
    );
    $items[] = array(
      'path' => 'admin/node/overview',
      'title' => t('list'),
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => -10,
    );
    if (module_exist('search')) {
      $items[] = array(
        'path' => 'admin/node/search',
        'title' => t('search'),
        'callback' => 'node_admin_search',
        'access' => user_access('administer nodes'),
        'type' => MENU_LOCAL_TASK,
      );
    }
    $items[] = array(
      'path' => 'admin/settings/node',
      'title' => t('posts'),
      'callback' => 'node_configure',
      'access' => user_access('administer nodes'),
    );
    $items[] = array(
      'path' => 'admin/settings/content-types',
      'title' => t('content types'),
      'callback' => 'node_types_configure',
      'access' => user_access('administer nodes'),
    );
    $items[] = array(
      'path' => 'node',
      'title' => t('content'),
      'callback' => 'node_page',
      'access' => user_access('access content'),
      'type' => MENU_MODIFIABLE_BY_ADMIN,
    );
    $items[] = array(
      'path' => 'node/add',
      'title' => t('create content'),
      'callback' => 'node_page',
      'access' => user_access('access content'),
      'type' => MENU_ITEM_GROUPING,
      'weight' => 1,
    );
    $items[] = array(
      'path' => 'rss.xml',
      'title' => t('rss feed'),
      'callback' => 'node_feed',
      'access' => user_access('access content'),
      'type' => MENU_CALLBACK,
    );
  }
  else {
    if (arg(0) == 'node' && is_numeric(arg(1))) {
      $node = node_load(arg(1));
      if ($node->nid) {
        $items[] = array(
          'path' => 'node/' . arg(1),
          'title' => t('view'),
          'callback' => 'node_page',
          'access' => node_access('view', $node),
          'type' => MENU_CALLBACK,
        );
        $items[] = array(
          'path' => 'node/' . arg(1) . '/view',
          'title' => t('view'),
          'type' => MENU_DEFAULT_LOCAL_TASK,
          'weight' => -10,
        );
        $items[] = array(
          'path' => 'node/' . arg(1) . '/edit',
          'title' => t('edit'),
          'callback' => 'node_page',
          'access' => node_access('update', $node),
          'weight' => 1,
          'type' => MENU_LOCAL_TASK,
        );
        $items[] = array(
          'path' => 'node/' . arg(1) . '/delete',
          'title' => t('delete'),
          'callback' => 'node_delete_confirm',
          'access' => node_access('delete', $node),
          'weight' => 1,
          'type' => MENU_CALLBACK,
        );
        $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' => 'node_revisions',
          'access' => $revisions_access,
          'weight' => 2,
          'type' => MENU_LOCAL_TASK,
        );
        $items[] = array(
          'path' => 'node/' . arg(1) . '/revisions/' . arg(3) . '/delete',
          'title' => t('revisions'),
          'callback' => 'node_revisions',
          'access' => $revisions_access,
          'weight' => 2,
          'type' => MENU_CALLBACK,
        );
        $items[] = array(
          'path' => 'node/' . arg(1) . '/revisions/' . arg(3) . '/revert',
          'title' => t('revisions'),
          'callback' => 'node_revisions',
          'access' => $revisions_access,
          'weight' => 2,
          'type' => MENU_CALLBACK,
        );
      }
    }
    else {
      if (arg(0) == 'admin' && arg(1) == 'settings' && arg(2) == 'content-types' && is_string(arg(3))) {
        $items[] = array(
          'path' => 'admin/settings/content-types/' . arg(3),
          'title' => t("'%name' content type", array(
            '%name' => node_get_name(arg(3)),
          )),
          'type' => MENU_CALLBACK,
        );
      }
    }
  }
  return $items;
}