function _submenutree_block_extended_links in Submenu Tree 7.2
Return block of extended links
1 call to _submenutree_block_extended_links()
- submenutree_block_view in ./
submenutree.module - Implements of hook_block_view().
File
- ./
submenutree.module, line 665 - Primarily Drupal hooks and processing the Submenu Tree display.
Code
function _submenutree_block_extended_links() {
$menu_name = variable_get('submenutree_extended_menu_name', 'main-menu');
$menu_level = variable_get('submenutree_extended_menu_level', 1);
// Loosely derived from menu_navigation_links()
$parent = FALSE;
$tree = menu_tree_page_data($menu_name);
// Go down the active trail until the right level is reached.
while ($menu_level-- > 0 && $tree) {
// Loop through the current level's items until we find one that is in trail.
while ($item = array_shift($tree)) {
if ($item['link']['in_active_trail']) {
$parent = $item;
// If the item is in the active trail, we continue in the subtree.
$tree = empty($item['below']) ? array() : $item['below'];
break;
}
}
}
if (!empty($parent)) {
$title = $parent['link']['title'];
$output = menu_tree_output($tree);
}
if (!empty($output)) {
$block = array(
'subject' => $title,
'content' => $output,
);
return $block;
}
}