I have a node title "SHOW & TELL".
In the quicktabs tab (I'm using class quicktabs) it displays incorrectly as "SHOW & TELL"
The title in the display of the node itself (generated by Views module) does display correctly.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

cpelham’s picture

Correction: Quicktabs is incorrectly displaying it as & instead of as &

How can I get the & to display correctly?

cpelham’s picture

Title: ampersand from Title get escaped (or double escaped?) » ampersand from Title gets escaped (or double escaped?)

This seems like it would be pretty straight-forward to fix but I just don't know enough to code it myself. Does anyone have any ideas?

cpelham’s picture

Priority: Normal » Major

OK, this is also a problem with apostrophes and likely with other characters that would get escaped. How are other people dealing with this? It is so ugly! I don't know how other people can stand it.

ivrh’s picture

Version: 7.x-3.0 » 7.x-3.3
Component: Tab styles » Code
Assigned: Unassigned » ivrh
Priority: Major » Normal
Status: Active » Needs review
Issue tags: +quicktabs, +htmlentities
FileSize
566 bytes

The issue with htmlentities is not related to the module, but rather with the way drupal handles links (via l() function) and translations (via t() function).

The patch attached resolves the issue with htmlentities for those of you who really need to display symbols instead of html code.

sime’s picture

Status: Needs review » Reviewed & tested by the community

This patch has been working well for us.

sime’s picture

Version: 7.x-3.3 » 7.x-3.4

... on latest version that is

Liam Morland’s picture

netw3rker’s picture

Version: 7.x-3.4 » 7.x-3.x-dev
Issue summary: View changes

Can I get confirmation that this is still an issue, I can't reproduce it at all. If i can get some concrete steps to reproduce it and this patch fixes it, i'll apply it.

netw3rker’s picture

Status: Reviewed & tested by the community » Needs work
davidwhthomas’s picture

I just had this double ampersand encoding issue myself when using the 'callback' method to populate the quicktab.

I had a look and it turns out quicktabs is double escaping the page title (and hence breadcrumb title)

This is because it uses drupal_get_title to store the title, which passes it through check_plain
It then calls drupal_set_title which check_plain's the escaped title again.

The attached patch prevents the double encoding in drupal_set_title when using the 'callback' method of populating quicktab content.

capfive’s picture

Status: Needs work » Needs review

this happens for me even with the patches applied, here are the steps to reproduce

1. create view of taxonomy displayed using quicktabs
2. add taxonomy name and and content for example
3. anything with an Ampersand comes out as &

Driving me nuts! please help!

The last submitted patch, 4: quicktabs.htmlentities.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 10: 1302760-quicktabs-title-double-encode-fix.patch, failed testing.

capfive’s picture

Assigned: ivrh » Unassigned
Status: Needs work » Needs review

I managed to get this fixed.

So where the view is being built I applied the same <?php html_entity_decode() ?> function to get it to decode the view title.

Here is the change i applied as I don't know how to create a patch!

In sites/all/modules/quicktabs/includes/quicktabs_style_plugin.inc

Line 122 <?php 'title' => $title, ?>

-- 'title' => $title,
++ 'title' => html_entity_decode($title)

Here is the code in context

<?php
      if ($this->options['grouping']) {

        // Remove labels from titles.
        foreach (element_children($this->options['grouping']) as $key => $value) {
          if (!empty($this->view->field[$this->options['grouping'][$key]['field']]->options['label'])) {
            $title = str_replace($this->view->field[$this->options['grouping'][$key]['field']]->options['label'] . ': ', '', $title);
          }
        }

        $contents = '';
        foreach ($rows as $row) {
          $contents .= '<div class="quicktabs-views-group">' . $row . '</div>';
        }
        $tabs[] = array(
          'title' => html_entity_decode($title),
          'contents' => array('#markup' => $contents),
        );
      }
?>

I also applied the same to the single row setup

<?php
      // If not grouped, there's just one set of rows that we loop through.
      else {
        foreach ($rows as $index => $row) {
          $title = $this->get_field($index, $this->options['tab_title_field']);
          $tabs[] = array(
            'title' => html_entity_decode($title),
            'contents' => array('#markup' => $row),
          );
        }
      }
?>

Happy coding!

jessZ’s picture

I have this problem as well. Titles displayed on the same page where a quick tab is enabled display ampersands and smart quotes incorrectly. Has this been fixed in 7.x-3.8 I have 7.x-3.6 installed. Will updating the module fix this?

lunazoid’s picture

I was having this problem with quicktabs 3.8. The patch by @capfive would fix the tab title text, but we were also using an image field to have icons on the tabs. By default, quicktabs was rendering the image as the html text. This patch decodes the generated output before returning, which seems to fix the issues in my case.