function theme_nice_menu_build in Nice Menus 6
Helper function that builds the nested lists of a nice menu.
Parameters
$menu: Menu array from which to build the nested lists.
1 theme call to theme_nice_menu_build()
- theme_nice_menu_tree in ./
nice_menus.module - Builds the final nice menu.
File
- ./
nice_menus.module, line 267 - Module to enable CSS dropdown and flyout menus.
Code
function theme_nice_menu_build($menu) {
$output = '';
foreach ($menu as $menu_item) {
$mlid = $menu_item['link']['mlid'];
// Check to see if it is a visible menu item.
if ($menu_item['link']['hidden'] == 0) {
// Build class name based on menu path
// e.g. to give each menu item individual style.
// Strip funny symbols.
$clean_path = str_replace(array(
'http://',
'www',
'<',
'>',
'&',
'=',
'?',
':',
), '', $menu_item['link']['href']);
// Convert slashes to dashes.
$clean_path = str_replace('/', '-', $clean_path);
$path_class = 'menu-path-' . $clean_path;
// If it has children build a nice little tree under it.
if (!empty($menu_item['link']['has_children']) && !empty($menu_item['below'])) {
// Keep passing children into the function 'til we get them all.
$children = theme('nice_menu_build', $menu_item['below']);
// Set the class to parent only of children are displayed.
$parent_class = $children ? 'menuparent ' : '';
$output .= '<li id="menu-' . $mlid . '" class="' . $parent_class . $path_class . '">' . theme('menu_item_link', $menu_item['link']);
// Build the child UL only if children are displayed for the user.
if ($children) {
$output .= '<ul>';
$output .= $children;
$output .= "</ul>\n";
}
$output .= "</li>\n";
}
else {
$output .= '<li id="menu-' . $mlid . '" class="' . $path_class . '">' . theme('menu_item_link', $menu_item['link']) . '</li>' . "\n";
}
}
}
return $output;
}