You are here

function admin_menu_item_url in Administration menu 5.2

Same name and namespace in other branches
  1. 5.3 admin_menu.module \admin_menu_item_url()

Adjust the menu item path.

Adjust the path of local tasks and let them point to their parent item. Finally build the url. These functions have been moved here to be able to cache the final results.

Parameters

&$item: An admin menu item.

3 calls to admin_menu_item_url()
admin_menu_add_item in ./admin_menu.module
Add a custom menu item.
admin_menu_build in ./admin_menu.inc
Build the administration menu tree.
_admin_menu_get_children in ./admin_menu.inc
Recursively adds items to the administration menu.

File

./admin_menu.module, line 329
Renders a menu tree for administrative purposes as dropdown menu at the top of the window.

Code

function admin_menu_item_url(&$_admin_menu, $mid) {
  $link_item = $mid;
  while ($_admin_menu[$link_item]['type'] & MENU_LINKS_TO_PARENT) {
    $link_item = $_admin_menu[$link_item]['pid'];
  }
  if (!isset($_admin_menu[$link_item]['processed'])) {
    $_admin_menu[$mid]['path'] = url($_admin_menu[$link_item]['path'], isset($_admin_menu[$mid]['query']) ? $_admin_menu[$mid]['query'] : NULL);
    $_admin_menu[$link_item]['processed'] = TRUE;
  }
  else {

    // Copy the already processed path of the parent item to the
    // default local task.
    $_admin_menu[$mid]['path'] = $_admin_menu[$link_item]['path'];
  }
}