function theme_accordion_menu_header in Accordion Menu 6
Same name and namespace in other branches
- 7 includes/view.inc \theme_accordion_menu_header()
Returns HTML for the accordion menu header and submenu items.
Parameters
$element: An associative array containing the menu object being formatted.
File
- includes/
view.inc, line 296 - Provides view routines.
Code
function theme_accordion_menu_header($element) {
$sub_menu = '';
$header = check_plain($element['config']['header']);
$header_link = $element['config']['header_link'];
if ($element['below']) {
$sub_menu = $element['below'];
}
if (!$header_link && !empty($element['below'])) {
// @todo Allow the title to be output without cleansing based on user input.
// Merge in defaults.
$options = $element['localized_options'];
$options += array(
'attributes' => array(),
'html' => FALSE,
);
$tag = 'span';
$link = '<' . $tag . drupal_attributes($options['attributes']) . '>' . ($options['html'] ? $element['title'] : check_plain($element['title'])) . '</' . $tag . '>';
}
else {
$link = l($element['title'], $element['href'], $element['localized_options']);
}
// The standard menu rendering nests the sub_menu items beneath the header.
// For the accordion effect to work, the sub_menu must be wrapped in a "div"
// following the header element.
$output = '<' . $header . drupal_attributes($element['attributes']) . '>' . $link . '</' . $header . '>' . "\n";
return $output . '<div class="accordion-content-' . $element['count'] . '">' . $sub_menu . '</div>' . "\n";
}