From 24de8090c06b85bd8153e4b3e1ce7a2e6677683b Mon Sep 17 00:00:00 2001
From: Angie Byron <webchick@24967.no-reply.drupal.org>
Date: Wed, 8 Dec 2010 06:48:39 +0000
Subject: [PATCH] #975754 by jhodgdon: Fixed problems with hook_menu()
 documentation.

---
 includes/menu.inc             |  5 +++--
 modules/system/system.api.php | 20 +++++++++++++-------
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/includes/menu.inc b/includes/menu.inc
index 1488dc8cd31f..5be5b1128b08 100644
--- a/includes/menu.inc
+++ b/includes/menu.inc
@@ -49,8 +49,9 @@
  * Access to the callback functions is also protected by the menu system.
  * The "access callback" with an optional "access arguments" of each menu
  * item is called before the page callback proceeds. If this returns TRUE,
- * then access is granted; if FALSE, then access is denied. Menu items may
- * omit this attribute to use the value provided by an ancestor item.
+ * then access is granted; if FALSE, then access is denied. Default local task
+ * menu items (see next paragraph) may omit this attribute to use the value
+ * provided by the parent item.
  *
  * In the default Drupal interface, you will notice many links rendered as
  * tabs. These are known in the menu system as "local tasks", and they are
diff --git a/modules/system/system.api.php b/modules/system/system.api.php
index 259c608a4804..4be4a766049c 100644
--- a/modules/system/system.api.php
+++ b/modules/system/system.api.php
@@ -1002,21 +1002,22 @@ function hook_menu_get_item_alter(&$router_item, $path, $original_map) {
  * $items['admin/config/foo'] = array(
  *   'title' => 'Foo settings',
  *   'type' => MENU_NORMAL_ITEM,
- *   // page callback, etc. need to be added here
+ *   // Page callback, etc. need to be added here.
  * );
  * // Make "Global settings" the main tab on the "Foo settings" page
  * $items['admin/config/foo/global'] = array(
  *   'title' => 'Global settings',
  *   'type' => MENU_DEFAULT_LOCAL_TASK,
- *   // access callback, page callback, and theme callback will be inherited
- *   // from 'admin/config/foo', if not specified here to override
+ *   // Access callback, page callback, and theme callback will be inherited
+ *   // from 'admin/config/foo', if not specified here to override.
  * );
  * // Make an additional tab called "Node settings" on "Foo settings"
  * $items['admin/config/foo/node'] = array(
  *   'title' => 'Node settings',
  *   'type' => MENU_LOCAL_TASK,
- *   // access callback, page callback, and theme callback will be inherited
- *   // from 'admin/config/foo', if not specified here to override
+ *   // Page callback and theme callback will be inherited from
+ *   // 'admin/config/foo', if not specified here to override.
+ *   // Need to add access callback or access arguments.
  * );
  * @endcode
  *
@@ -1045,9 +1046,14 @@ function hook_menu_get_item_alter(&$router_item, $path, $original_map) {
  *     rights to this menu item, and FALSE if not. It can also be a boolean
  *     constant instead of a function, and you can also use numeric values
  *     (will be cast to boolean). Defaults to user_access() unless a value is
- *     inherited from a parent menu item.
+ *     inherited from the parent menu item; only MENU_DEFAULT_LOCAL_TASK items
+ *     can inherit access callbacks. To use the user_access() default callback,
+ *     you must specify the permission to check as 'access arguments' (see
+ *     below).
  *   - "access arguments": An array of arguments to pass to the access callback
- *     function, with path component substitution as described above.
+ *     function, with path component substitution as described above. If the
+ *     access callback is inherited (see above), the access arguments will be
+ *     inherited with it, unless overridden in the child menu item.
  *   - "theme callback": (optional) A function returning the machine-readable
  *     name of the theme that will be used to render the page. If not provided,
  *     the value will be inherited from a parent menu item. If there is no
-- 
GitLab