Tabs missing request URI information, faulty destination

glottus - May 29, 2008 - 16:18
Project:Javascript Tools
Version:5.x-1.1
Component:Tabs
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

Previously posted under http://drupal.org/node/259413 when I thought this was a Panels Tabs Style issue, but seem to have fixed it with a small addition to tabs.module:

Tabs (of panel panes) were being rendered with an a href anchor that didn't include the request URI information.

For example, a user profile split into two tabs SHOULD have tab destinations similar to the following:
mysite.com/user/glottus#tabs-user-profile-userprofile-1
mysite.com/user/glottus#tabs-user-profile-userprofile-2

Problem was, they were getting rendered as href="#tabs-user-profile-userprofile-1", resulting effectively in tabs with the following destinations:
mysite.com/#tabs-user-profile-userprofile-1
mysite.com/#tabs-user-profile-userprofile-2

This caused a redirect to the main page instead of showing the correct tab content.

I seem to have fixed this on my site with the following change made to tabs.module:

in theme_tabset, change

<?php
      $output
.= '<li'. drupal_attributes($element[$key]['#attributes']) .'><a href="#tabs-'. $element['#tabset_name'] .'-'. $element[$key]['#index'] .'">'. $element[$key]['#title'] .'</a></li>';
?>

to read

<?php
      $output
.= '<li'. drupal_attributes($element[$key]['#attributes']) .'><a href="' . request_uri() . '#tabs-'. $element['#tabset_name'] .'-'. $element[$key]['#index'] .'">'. $element[$key]['#title'] .'</a></li>';
?>

Can anyone tell me if this was intentionally left out? Am I better off trying to theme this function, rather than hardcoding this change into the module?

#1

Andrewtr - June 27, 2009 - 06:30

Thanks... It helped me a lot...

 
 

Drupal is a registered trademark of Dries Buytaert.