theme_menu_helper_submenu_definition

custom/menu_helper/menu_helper_submenu/menu_helper_submenu.module, line 517

Versions
6
theme_menu_helper_submenu_definition($tree, $settings)

Theme submenu tree as definition list.

Code

<?php
function theme_menu_helper_submenu_definition($tree, $settings) {
  $num_links = count($tree);
  $i = 1;
  $output = '<dl>';

  foreach ($tree as $item) {
    $extra_class = '';
    if ($i == 1) {
      $extra_class .= 'first ';
    }
    if ($i == $num_links) {
      $extra_class .= 'last ';
    }
    $i++;
    $output .= '<dt'. (($extra_class) ? ' '. drupal_attributes(array('class' => $extra_class)) : '') .'>';
    $output .= theme('menu_item_link', $item['link']);
    $output .= '</dt>';

    if ( $settings['show_descriptions'] == MENU_HELPER_SUBMENU_DESCRIPTION_YES || $item['below']) {
      $output .= '<dd>';
      if ($description = $item['link']['options']['attributes']['title'] && $item['link']['title'] != $item['link']['options']['attributes']['title']) {
        $output .= check_plain($description);
      }
      if ( $item['below'] ) {
        $output .= theme('menu_helper_submenu_list', $item['below'], $settings);
      }
      $output .= '</dd>';
    }
  }
  $output .= '</dl>';
  return $output;
}
?>