Same name and namespace in other branches
- 4.7.x modules/menu.module \menu_parent_options()
- 5.x modules/menu/menu.module \menu_parent_options()
- 6.x modules/menu/menu.module \menu_parent_options()
- 7.x modules/menu/menu.module \menu_parent_options()
Return a list of menu items that are valid possible parents for the given menu item.
File
- modules/
menu.module, line 489 - Allows administrators to customize the site navigation menu.
Code
function menu_parent_options($mid, $pid = 0, $depth = 0) {
$menu = menu_get_menu();
$options = array();
if (isset($menu['items'][$pid]) && $menu['items'][$pid]['children']) {
usort($menu['items'][$pid]['children'], '_menu_sort');
foreach ($menu['items'][$pid]['children'] as $child) {
if ($child != $mid) {
if ($child > 0 && $menu['items'][$child]['type'] & (MENU_MODIFIABLE_BY_ADMIN | MENU_IS_ROOT)) {
$title = ' ' . $menu['items'][$child]['title'];
for ($i = 0; $i < $depth; $i++) {
$title = '--' . $title;
}
if (!($menu['items'][$child]['type'] & MENU_VISIBLE_IN_TREE)) {
$title .= ' (' . t('disabled') . ')';
}
$options[$child] = $title;
}
$options += menu_parent_options($mid, $child, $depth + 1);
}
}
}
return $options;
}