function menu_block_split_render_tree in Menu Block Split 6.2
Same name and namespace in other branches
- 6 menu_block_split.module \menu_block_split_render_tree()
- 7.2 menu_block_split.module \menu_block_split_render_tree()
Render menu
Parameters
array $tree:
int $level:
Return value
menu tree
1 call to menu_block_split_render_tree()
- theme_menu_block_split_menu in ./
menu_block_split.module - Theme menu.
File
- ./
menu_block_split.module, line 195 - Allow a menu to be split over two blocks Developed by Robert Garrigos <robert@garrigos.cat> Modified for Drupal 6.x by Frank Meyerer <meyerer@digi-info.de> http://www.digi-info.de currently maintained by Bob Hutchinson…
Code
function menu_block_split_render_tree($tree, $level) {
$output = '';
$num_items = menu_block_split_count_active_items($tree);
$n = 1;
foreach ($tree as $i => $mid) {
if ($mid['link']['hidden'] == 0) {
$link = theme('menu_block_split_menu_item_link', $mid['link']);
// our first block
if ($level > 0) {
$extra_class = 'menu-' . $mid['link']['mlid'];
if ($n == 1) {
$extra_class .= ' first ';
}
if ($n == $num_items) {
$extra_class .= ' last ';
}
$trail = menu_get_active_trail();
foreach ($trail as $item) {
if (isset($item['mlid']) && $item['mlid'] == $mid['link']['mlid'] && $item['in_active_trail']) {
$extra_class .= ' active-trail ';
}
}
$output .= theme('menu_block_split_menu_item', $link, '', '', FALSE, $extra_class);
}
else {
if ($mid['below']) {
$output .= menu_block_split_menu_tree_output($mid['below']);
}
}
}
$n++;
}
return $output;
}