menu_get_item

  1. drupal
    1. 4.7
    2. 5
    3. 6 menu.inc
    4. 7 menu.inc
Versions
4.7 – 5 menu_get_item($mid, $path = NULL, $reset = FALSE)
6 – 7 menu_get_item($path = NULL, $router_item = NULL)

Retrieves the menu item specified by $mid, or by $path if $mid is not given.

Parameters

$mid The menu ID of the menu item to retrieve.

$path The internal path of the menu item to retrieve. Defaults to NULL. Only used if $mid is not set.

$reset Optional flag that resets the static variable cache of the menu tree, if set to TRUE. Default is FALSE.

Return value

The menu item found in the site menu, or an empty array if none could be found.

Related topics

▾ 13 functions call menu_get_item()

menu_block in modules/menu.module
Implementation of hook_block().
menu_disable_item in modules/menu.module
Menu callback; hide a menu item.
menu_get_active_breadcrumb in includes/menu.inc
Returns an array of rendered menu items in the active breadcrumb trail.
menu_get_active_nontask_item in includes/menu.inc
Returns the ID of the current menu item or, if the current item is a local task, the menu item to which this task is attached.
menu_get_active_title in includes/menu.inc
Returns the title of the active menu item.
menu_get_menu in includes/menu.inc
Return the menu data structure.
menu_item_link in includes/menu.inc
Returns the rendered link to a menu item.
menu_overview_tree_rows in modules/menu.module
menu_parent_options in modules/menu.module
Return a list of menu items that are valid possible parents for the given menu item. The list excludes the given item and its children.
menu_rebuild in includes/menu.inc
Populate the database representation of the menu.
menu_save_item in modules/menu.module
Save a menu item to the database.
menu_set_active_item in includes/menu.inc
Sets the path of the active menu item.
_menu_get_active_trail in includes/menu.inc
Returns an array with the menu items that lead to the current menu item.

Code

includes/menu.inc, line 272

<?php
function menu_get_item($mid, $path = NULL, $reset = FALSE) {
  static $menu;

  if (!isset($menu) || $reset) {
    $menu = menu_get_menu();
  }

  if (isset($mid)) {
    return $menu['items'][$mid];
  }

  if (isset($path)) {
    return $menu['items'][$menu['path index'][$path]];
  }

  return array();
}
?>