When you create Panel Tab, the tabs are given pretty ambiguous names (e.g. #tabs-node_panel-node_panel-5). It would be very neat to get this working with custom panel names (e.g. #mytab).

Comments

robloach’s picture

Category: feature » support

This would:

  1. Help with SEO
  2. Provide pretty URLs for the user
  3. Provide a common address and static URLs for tabs so that links don't change when tabs are added, or removed

We'd have to do some modifications in JSTools Tabs to get this working.

wim leers’s picture

Category: support » feature

This has been requested before, and indeed the answer is still the same: we need to modify jstools' tabs module to support this. Note that I've got commit access there, so if you could provide the patch, it could be done rather rapidly :) I don't have time to do it myself due to upcoming exams.

Anonymous’s picture

Category: support » feature

I just quickly hacked this in for my current project..

<?php
/**
 *  @package tabs.module
 *  Return rendered tabset.
 */
function phptemplate_tabset($element) {
  $output = '<div id="tabs-'. $element['#tabset_name'] .'"'. drupal_attributes($element['#attributes']) .'>';
  $output .= '<ul class="anchors">';
  foreach (element_children($element) as $key) {
    if ($element[$key]['#type'] && $element[$key]['#type'] == 'tabpage') {
      $hash = strtolower(form_clean_id($element[$key]['#title']));
      $output .= '<li'. drupal_attributes($element[$key]['#attributes']) .'><a href="#tabs-'. $element['#tabset_name'] .'-'. $hash .'">'. $element[$key]['#title'] .'</a></li>';
    }
  }
  $output .= '</ul>';
  $output .= $element['#children'];
  $output .= '</div>';
  return $output;
}

/**
 *  @package tabs.module
 *  Return rendered content of a tab.
 */
function phptemplate_tabpage($element) {
  $hash = strtolower(form_clean_id($element['#title']));
  $output ='<div id="tabs-'. $element['#tabset_name'] .'-'. $hash .'" class="fragment">';
  $output .= '<h2 class="drupal-tabs-title">'. $element['#title'] .'</h2>';
  $output .= $element['#content'] . $element['#children'];
  $output .='</div>';
  return $output;
}
?>
Anonymous’s picture

Another tweak i just made.. instead of passing in $id as the key in $tabs, i switched it to $panel_id.

I did this because for my user_profile panel, it was showing it like #tabs-user_profile-user-profile-2.

Now with these 2 tweaks, my hashes look like..

#tabs-user-profile-user_profile-pictures

<?php
$tabs[$panel_id] = array(
    '#type' => 'tabset',
  );
  $index = 0;
  foreach ($panes as $pane_id => $content) {
    // Remove the title from the content. We don't want titles in both the tab
    // and the content associated with the tab.
    $content_without_title = drupal_clone($content);
    unset($content_without_title->title);

    $tabs[$panel_id][$pane_id] = array(
      '#type' => 'tabpage',
      '#title' => $content->title,
      '#content' => theme('panels_pane', $content_without_title, $display->content[$pane_id], $display),
      '#weight' => $index,
    );
    $index++;
  }
  $output = tabs_render($tabs);
?>

EDIT:

oops.. i mean like #tabs-user_profile-about

wim leers’s picture

Project: Panels Tabs » Tabs (jQuery UI tabs)
Version: 5.x-1.x-dev » 6.x-1.x-dev
Component: User interface » Code

To the right issue queue.

nedjo’s picture

Status: Active » Fixed

Applied a fix. The name is now taken from the tab title.

nedjo’s picture

Status: Fixed » Active

I'm rolling back this change. #554426: problem with content profile shows that special characters break tabs. The issue is that tab text sometimes comes from e.g. node or panel titles which can contain special characters.

nedjo’s picture

Status: Active » Fixed

I applied #556866: element ids should not contain characters outside ascii96 and reinstated named tabs, making this a configurable option so that sites with many special characters can turn it off if desired.

Status: Fixed » Closed (fixed)

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