Project:Tabs (jQuery UI tabs)
Version:6.x-1.0
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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

#1

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

#2

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

#3

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

#4

Try this out (Drupal 5 code):

<?php
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>

#5

Category:feature request» support request
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.

#6

Status:fixed» closed (fixed)

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

nobody click here