function _menu_build_local_tasks in Drupal 4
Same name and namespace in other branches
- 5 includes/menu.inc \_menu_build_local_tasks()
Find all the items in the current local task tree.
Since this is only for display, we only need title, path, and children for each item.
At the close of this function, $_menu['local tasks'] is populated with the menu items in the local task tree.
Return value
TRUE if the local task tree is forked. It does not need to be displayed otherwise.
1 call to _menu_build_local_tasks()
- menu_get_local_tasks in includes/
menu.inc - Return the local task tree.
File
- includes/
menu.inc, line 1311 - API for the Drupal menu system.
Code
function _menu_build_local_tasks($pid) {
global $_menu;
$forked = FALSE;
if (isset($_menu['items'][$pid])) {
$parent = $_menu['items'][$pid];
$children = array();
if (isset($parent['children'])) {
foreach ($parent['children'] as $mid) {
if ($_menu['items'][$mid]['type'] & MENU_IS_LOCAL_TASK && _menu_item_is_accessible($mid)) {
$children[] = $mid;
// Beware short-circuiting || operator!
$forked = _menu_build_local_tasks($mid) || $forked;
}
}
}
usort($children, '_menu_sort');
$forked = $forked || count($children) > 1;
$_menu['local tasks'][$pid] = array(
'title' => $parent['title'],
'path' => $parent['path'],
'children' => $children,
);
foreach ($children as $mid) {
$_menu['local tasks'][$mid]['pid'] = $pid;
}
}
return $forked;
}