I am having an issue when using characters such as "&" in the tab title. When the actual tab set is being displayed, the title is rendering the code as the HTML entity "&". This issue only occurred after upgrading to the latest dev version.

CommentFileSizeAuthor
#1 views_tabs_html_decode_titles.patch344 bytesjdschroeder

Comments

jdschroeder’s picture

Status: Active » Needs review
StatusFileSize
new344 bytes

And here's a patch for flexman's fix. Simply wrapping $title in html_entity_decode. This has fixed the problem in our instance, but this ought to be reviewed.

jdwfly’s picture

This only happens when using fields. It seems that it is being double escaped. First by views and then by the link function. This may be a good solution, but I am still checking to see if there is another way to do it.

jdwfly’s picture

Status: Needs review » Needs work

This can be overridden via a theme function. Put the following function into template.php and rename function name accordingly.

function theme_tabset($element) {
  $output = '<div id="tabs-'. $element['#tabset_name'] .'"'. drupal_attributes($element['#attributes']) .'>';
  $output .= '<ul class="tabs 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">'. html_entity_decode($element[$key]['#title']) .'</span></a></li>';
      }
    }
  }
  $output .= '</ul>';
  if (isset($element['#children'])) {
    $output .= $element['#children'];
  }
  $output .= '</div>';
  return $output;
}

I don't think I'll commit this yet as I am not sure about the actual problem. It doesn't look like it is being double escaped.

darkdim’s picture

bookmark

nedjo’s picture

Status: Needs work » Fixed

Applied a fix.

jdwfly’s picture

Status: Fixed » Active

I don't see a commit nedjo? Did this get applied somewhere else like the Tabs module?

jdwfly’s picture

Status: Active » Fixed

Moving back to fixed.

Status: Fixed » Closed (fixed)

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