menu_parent_options
- Versions
- 4.6 – 5
menu_parent_options($mid,$pid= 0,$depth= 0)- 6 – 7
menu_parent_options($menus, $item)
Return a list of menu items that are valid possible parents for the given menu item.
Code
modules/menu.module, line 489
<?php
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;
}
?>Login or register to post comments 