You are here

function admin_menu_move_item in Administration menu 5

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

Moves the child pointer for a menu item to a new parent.

Parameters

admin_items: The sliced administration menu.

path: The menu path of the item to move.

parent_path: The menu path of the new parent item.

1 call to admin_menu_move_item()
admin_menu_adjust_items in ./admin_menu.inc

File

./admin_menu.inc, line 181

Code

function admin_menu_move_item(&$admin_items, $path, $parent_path) {
  global $_menu;
  $mid = $_menu['path index'][$path];
  $new_pid = $_menu['path index'][$parent_path];
  if (isset($admin_items[$mid]) && isset($admin_items[$new_pid])) {

    // remove current child pointer
    admin_menu_remove_item($admin_items, $path);

    // insert new child pointer
    $admin_items[$mid]['pid'] = $new_pid;
    array_unshift($admin_items[$new_pid]['children'], $mid);
    return true;
  }
  else {
    return false;
  }
}