You are here

function theme_quicktabs_tabs in Quick Tabs 6.3

Same name and namespace in other branches
  1. 5 quicktabs.module \theme_quicktabs_tabs()
  2. 6 quicktabs.module \theme_quicktabs_tabs()
  3. 6.2 quicktabs.module \theme_quicktabs_tabs()
  4. 7.2 quicktabs.module \theme_quicktabs_tabs()

Theme function for output of the tabs. Use this to ADD extra classes. The general structure 'ul.quicktabs_tabs li a' needs to be maintained for the jQuery to work.

1 theme call to theme_quicktabs_tabs()
quicktabs_render in ./quicktabs.module
Render quicktabs.

File

./quicktabs.module, line 361

Code

function theme_quicktabs_tabs($quicktabs, $active_tab = 'none') {
  $output = '';
  $tabs_count = count($quicktabs['tabs']);
  if ($tabs_count <= 0) {
    return $output;
  }
  $index = 1;
  $output .= '<ul class="quicktabs_tabs quicktabs-style-' . drupal_strtolower($quicktabs['style']) . '">';
  foreach ($quicktabs['tabs'] as $tabkey => $tab) {
    if (!empty($tab)) {
      $class = 'qtab-' . $tabkey;

      // Add first, last and active classes to the list of tabs to help out themers.
      $class .= $tabkey == $active_tab ? ' active' : '';
      $class .= $index == 1 ? ' first' : '';
      $class .= $index == $tabs_count ? ' last' : '';
      $attributes_li = drupal_attributes(array(
        'class' => $class,
      ));
      $options = _quicktabs_construct_link_options($quicktabs, $tabkey);

      // Support for translatable tab titles with i18nstrings.module.
      if (module_exists('i18nstrings')) {
        $tab['title'] = i18nstrings('quicktabs:tab:' . $quicktabs['machine_name'] . '--' . $tabkey . ':title', $tab['title']);
      }
      $output .= '<li' . $attributes_li . '>' . l($tab['title'], $_GET['q'], $options) . '</li>';
      $index++;
    }
  }
  $output .= '</ul>';
  return $output;
}