Hi to all,

I would like to suggest a pair of little improvements on theming side:

1) It possible to insert in the main wrapper DIV a unique identifier for a better and more flexible theming operations without using of others nasty wrapper. It's a problem when you need different style amongst a large number of page with different Tabs solutions, especially when using a mix of Views Tabs and CCK fieldgroup Tab.

An example:


<div id="tabs-tabset" class="drupal-tabs js-hide tabs-processed">

Could become somenthing like:

<div id="tabs-tabset" class="drupal-tabs js-hide tabs-processed here-node-id">

2) It's possible to avoid "anonimous" DIV elements to list all the Tab contents?

For a better semantic use of HTML an UL list is better.

I tryed to override the theming function in this way but "something" (javascript i suppose) ovverride the code placing some classes in UL tag that broke everything

This my test:

function theme_tabset($element) {
  $output = '<div id="tabs-'. $element['#tabset_name'] .'"'. drupal_attributes($element['#attributes']) .'>';
  $output .= '<div class="description">'. $element['#description'] .'</div>';
  $output .= '<ul class="clear-block">';
  foreach (element_children($element) as $key) {
    if (isset($element[$key]['#type']) && $element[$key]['#type'] == 'tabpage') {
      // Ensure the tab has content before rendering it.
      if (
        (isset($element[$key]['#ajax_url']) && !empty($element[$key]['#ajax_url'])) ||
        (isset($element[$key]['#content']) && !empty($element[$key]['#content'])) ||
        (isset($element[$key]['#children']) && !empty($element[$key]['#children']))
      ) {
        $output .= '<li'. drupal_attributes($element[$key]['#attributes']) .'><a href="' . $element[$key]['#url'] . '"><span class="tab">'. $element[$key]['#title'] .'</span></a></li>';
  $output .= '</ul>';
 //HERE MY MOD $output .= '<ul class="content-tabs">';

  if (isset($element['#children'])) {
    $output .= $element['#children'];
 //HERE MY MOD $output .= '</ul>';
  $output .= '</div>';
  return $output;

function theme_tabpage($element) {
  $output = '';
  // Ensure the tab has content before rendering it.
  if (!empty($element['#ajax_url']) || !empty($element['#content']) || !empty($element['#children'])) {
 //HERE MY MOD    $output .= '<li d="' . $element['#tab_name'] . '" class="tabs-' . $element['#tabset_name'] . '">';
    $output .= '<h2 class="drupal-tabs-title js-hide">'. $element['#title'] .'</h2>';
    $output .= $element['#content'] . (!empty($element['#children']) ? $element['#children'] : '');
 //HERE MY MOD    $output .='</li>';
  return $output;

Thanks a lot!


Dret’s picture

Errata: in the second "code example, opening and closing UL tags are placed inside the "if" statement:

if (isset($element['#children'])) {

and not outside!