function theme_menu_links in Drupal 4
Same name and namespace in other branches
- 5 includes/menu.inc \theme_menu_links()
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
File
- includes/
menu.inc, line 899 - API for the Drupal menu system.
Code
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;
}