summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorGábor Hojtsy <gabor@hojtsy.hu>2007-10-25 08:24:43 +0000
committerGábor Hojtsy <gabor@hojtsy.hu>2007-10-25 08:24:43 +0000
commit4e187261abc63432130bd3b5661b622ba095ffeb (patch)
tree9fd4b59b53cd8a3b1fb2c0e04b65c9f6eb998d71 /includes
parent9d5516644c5e6b607d01d6349a2890668a354efb (diff)
downloadbrdo-4e187261abc63432130bd3b5661b622ba095ffeb.tar.gz
brdo-4e187261abc63432130bd3b5661b622ba095ffeb.tar.bz2
#177497 by chx and Desbeers: revive Drupal 5's menu_set_location() functionality by introducing menu_set_item() (for consistency in function naming), thus fixing a regression in the current development code. Also fixing some misuse of menu_set_location() by using drupal_set_breadcrumb() instead.
Diffstat (limited to 'includes')
-rw-r--r--includes/menu.inc38
1 files changed, 32 insertions, 6 deletions
diff --git a/includes/menu.inc b/includes/menu.inc
index 74694c8e0..ac835c243 100644
--- a/includes/menu.inc
+++ b/includes/menu.inc
@@ -267,17 +267,46 @@ function menu_unserialize($data, $map) {
}
}
+
+
/**
- * Get the menu callback for the a path.
+ * Replaces the statically cached item for a given path.
*
* @param $path
- * A path, or NULL for the current path
+ * The path.
+ * @param $router_item
+ * The router item. Usually you take a router entry from menu_get_item and
+ * set it back either modified or to a different path. This lets you modify the
+ * navigation block, the page title, the breadcrumb and the page help in one
+ * call.
*/
-function menu_get_item($path = NULL) {
+function menu_set_item($path, $router_item) {
+ menu_get_item($path, $router_item);
+}
+
+/**
+ * Get a router item.
+ *
+ * @param $path
+ * The path, for example node/5. The function will find the corresponding
+ * node/% item and return that.
+ * @param $router_item
+ * Internal use only.
+ * @return
+ * The router item, an associate array corresponding to one row in the
+ * menu_router table. The value of key map holds the loaded objects. The
+ * value of key access is TRUE if the current user can access this page.
+ * The values for key title, page_arguments, access_arguments will be
+ * filled in based on the database values and the objects loaded.
+ */
+function menu_get_item($path = NULL, $router_item = NULL) {
static $router_items;
if (!isset($path)) {
$path = $_GET['q'];
}
+ if (isset($router_item)) {
+ $router_items[$path] = $router_item;
+ }
if (!isset($router_items[$path])) {
$original_map = arg(NULL, $path);
$parts = array_slice($original_map, 0, MENU_MAX_PARTS);
@@ -1385,9 +1414,6 @@ function menu_get_active_trail() {
return menu_set_active_trail();
}
-function menu_set_location() {
-}
-
/**
* Get the breadcrumb for the current page, as determined by the active trail.
*/