theme_menu_links
Definition
theme_menu_links($links)
includes/menu.inc, line 899
Description
Returns the themed HTML for primary and secondary links. Note that this function is overridden by most core themes because those themes display links in "link | link" format, not from a list. Also note that by default links rendered with this function are displayed with the same CSS as is used for the local tasks. If a theme wishes to render links from a ul it is expected that the theme will provide suitable CSS.
Parameters
$links An array containing links to render.
Return value
A string containing the themed links.
Related topics
| Name | Description |
|---|---|
| Menu system | Define the navigation menus, and route page requests to code based on URLs. |
| Themeable functions | Functions that display HTML, and which can be customized by themes. |
Code
<?php
function theme_menu_links($links) {
if (!count($links)) {
return '';
}
$level_tmp = explode('-', key($links));
$level = $level_tmp[0];
$output = "<ul class=\"links-$level\">\n";
foreach ($links as $index => $link) {
$output .= '<li';
if (stristr($index, 'active')) {
$output .= ' class="active"';
}
$output .= ">$link</li>\n";
}
$output .= '</ul>';
return $output;
}
?> 