You are here

function admin_menu_remove_item in Administration menu 5.3

Same name and namespace in other branches
  1. 5 admin_menu.inc \admin_menu_remove_item()
  2. 5.2 admin_menu.inc \admin_menu_remove_item()

Removes the child pointer for a menu item.

Parameters

array $_admin_menu: An array containing the complete administration menu structure, passed by reference.

string $path: The menu path to remove, e.g. 'foo/bar'.

2 calls to admin_menu_remove_item()
admin_menu_adjust_items in ./admin_menu.inc
Add some hard-coded features for better user experience.
admin_menu_move_item in ./admin_menu.inc
Moves the child pointer of a menu item to a new parent.

File

./admin_menu.inc, line 412
Menu build functions for Administration menu.

Code

function admin_menu_remove_item(&$_admin_menu, $path) {
  global $_menu;
  $mid = $_admin_menu['index'][$path];
  if (isset($_admin_menu[$mid])) {
    $pid = $_admin_menu[$mid]['pid'];
    $child_key = array_search($mid, $_admin_menu[$pid]['children']);
    if ($child_key !== FALSE) {
      unset($_admin_menu[$pid]['children'][$child_key]);
      return TRUE;
    }
  }
  return FALSE;
}