summaryrefslogtreecommitdiff
path: root/modules/node.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2004-09-16 07:17:56 +0000
committerDries Buytaert <dries@buytaert.net>2004-09-16 07:17:56 +0000
commit5c7983c4deae55ad41b85ca99db54d3fce283fd9 (patch)
tree59801cd96a36c390586752c58d6cf5ba50c230ce /modules/node.module
parent6f0fd3aa55659f8bd6b023e8e82e990326c1b788 (diff)
downloadbrdo-5c7983c4deae55ad41b85ca99db54d3fce283fd9.tar.gz
brdo-5c7983c4deae55ad41b85ca99db54d3fce283fd9.tar.bz2
- Patch #8179 by JonBob: reintroduced menu caching.
Diffstat (limited to 'modules/node.module')
-rw-r--r--modules/node.module93
1 files changed, 48 insertions, 45 deletions
diff --git a/modules/node.module b/modules/node.module
index c7497a04c..9c7156ba2 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -626,62 +626,65 @@ function node_link($type, $node = 0, $main = 0) {
/**
* Implementation of hook_menu().
*/
-function node_menu() {
+function node_menu($may_cache) {
$items = array();
- $items[] = array('path' => 'admin/node', 'title' => t('content'),
- 'callback' => 'node_admin',
- 'access' => user_access('administer nodes'));
- $items[] = array('path' => 'admin/node/overview', 'title' => t('list'),
- 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
- $items[] = array('path' => 'admin/node/configure', 'title' => t('configure'),
- 'callback' => 'node_configure',
- 'access' => user_access('administer nodes'),
- 'type' => MENU_LOCAL_TASK);
- $items[] = array('path' => 'admin/node/configure/settings', 'title' => t('settings'),
- 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
- $items[] = array('path' => 'admin/node/configure/defaults', 'title' => t('default workflow'),
- 'callback' => 'node_default_settings',
- 'access' => user_access('administer nodes'),
- 'type' => MENU_LOCAL_TASK);
- if (module_exist('search')) {
- $items[] = array('path' => 'admin/node/search', 'title' => t('search'),
+ if ($may_cache) {
+ $items[] = array('path' => 'admin/node', 'title' => t('content'),
'callback' => 'node_admin',
+ 'access' => user_access('administer nodes'));
+ $items[] = array('path' => 'admin/node/overview', 'title' => t('list'),
+ 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
+ $items[] = array('path' => 'admin/node/configure', 'title' => t('configure'),
+ 'callback' => 'node_configure',
'access' => user_access('administer nodes'),
'type' => MENU_LOCAL_TASK);
- }
-
- $items[] = array('path' => 'node', 'title' => t('content'),
- 'callback' => 'node_page',
- 'access' => user_access('access content'),
- 'type' => MENU_SUGGESTED_ITEM);
- $items[] = array('path' => 'node/add', 'title' => t('create content'),
- 'callback' => 'node_page',
- 'access' => user_access('access content'),
- 'type' => MENU_ITEM_GROUPING,
- 'weight' => 1);
-
- if (arg(0) == 'node' && is_numeric(arg(1))) {
- $node = node_load(array('nid' => arg(1)));
+ $items[] = array('path' => 'admin/node/configure/settings', 'title' => t('settings'),
+ 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
+ $items[] = array('path' => 'admin/node/configure/defaults', 'title' => t('default workflow'),
+ 'callback' => 'node_default_settings',
+ 'access' => user_access('administer nodes'),
+ 'type' => MENU_LOCAL_TASK);
+ if (module_exist('search')) {
+ $items[] = array('path' => 'admin/node/search', 'title' => t('search'),
+ 'callback' => 'node_admin',
+ 'access' => user_access('administer nodes'),
+ 'type' => MENU_LOCAL_TASK);
+ }
- $items[] = array('path' => 'node/'. arg(1), 'title' => t('view'),
+ $items[] = array('path' => 'node', 'title' => t('content'),
'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'),
+ 'access' => user_access('access content'),
+ 'type' => MENU_SUGGESTED_ITEM);
+ $items[] = array('path' => 'node/add', 'title' => t('create content'),
'callback' => 'node_page',
- 'access' => node_access('update', $node),
- 'weight' => 1,
- 'type' => MENU_LOCAL_TASK);
+ 'access' => user_access('access content'),
+ 'type' => MENU_ITEM_GROUPING,
+ 'weight' => 1);
+ }
+ else {
+ if (arg(0) == 'node' && is_numeric(arg(1))) {
+ $node = node_load(array('nid' => arg(1)));
- if ($node->revisions) {
- $items[] = array('path' => 'node/'. arg(1) .'/revisions', 'title' => t('revisions'),
+ $items[] = array('path' => 'node/'. arg(1), 'title' => t('view'),
'callback' => 'node_page',
- 'access' => user_access('administer nodes'),
- 'weight' => 2,
+ '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);
+
+ if ($node->revisions) {
+ $items[] = array('path' => 'node/'. arg(1) .'/revisions', 'title' => t('revisions'),
+ 'callback' => 'node_page',
+ 'access' => user_access('administer nodes'),
+ 'weight' => 2,
+ 'type' => MENU_LOCAL_TASK);
+ }
}
}