The default theme function
function theme_tabset($element)
seems to allow themeing only for ALL tabsets.

It would be great is themeing could be at tabset level.

For example, on some tabs, I prefer the tabs at the bottom.

Regards
Alan

Comments

panji’s picture

yup,.. great idea,.. please help us

PinkChocobo’s picture

I've been trying to find a way to do this for 2 days now, grumble grumble

alanburke’s picture

Ok, It CAN be done. But it's not trivial.
function theme_tabset($element)
will do the job.
Basically, you can do a switch based on the $element[#name],
and the provide different theme code depending on the name.

No code to hand on this machine...

Alan

ebeyrent’s picture

Try this out (Drupal 5 code):

function mytheme_tabset($element) {
  $tabs = '';
  foreach (element_children($element) as $key) {
    if ($element[$key]['#type'] && $element[$key]['#type'] == 'tabpage') {
      // Call whichever template you want at this point
      $tabs .= _phptemplate_callback('mytab', array('key' => $key, 'element' => $element));
    }
  }
  return _phptemplate_callback('mytabset', array('tabs' => $tabs, 'children' => $element['#children'], 'tabset_name' => $element['#tabset_name']));
}
// mytab.tpl.php
<li <?php echo drupal_attributes($element[$key]['#attributes']); ?>>
  <a href="#tabs-<?php echo $element['#tabset_name'] .'-'. $element[$key]['#index'];?>">
    <span class="tab"><?php echo $element[$key]['#title']; ?></span>
  </a>
</li>
// mytabset.tpl.php
<div id="tabs-<?php echo $tabset_name.'"'. drupal_attributes($element['#attributes']); ?>>
  <ul class="anchors">
    <?php echo $tabs; ?>
  </ul>
  <?php echo $children; ?>
</div>
nedjo’s picture

Category: feature » support
Status: Active » Fixed

Since forms api calls the theme function it's not easy to introduce a per-tabset call.

So using the #tabset_name attribute seems to make sense. Note that you can explicitly set the #tabset_name in your tabset element if desired.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.