menu_get_item

5 menu.inc menu_get_item($mid, $path = NULL, $reset = FALSE)
6 menu.inc menu_get_item($path = NULL, $router_item = NULL)
7 menu.inc menu_get_item($path = NULL, $router_item = NULL)
8 menu.inc 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

17 calls to menu_get_item()

File

includes/menu.inc, line 271
API for the Drupal menu system.

Code

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();
}
Login or register to post comments