Drupal Answers is a question and answer site for Drupal developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've programmatically created some quicktabs in Drupal 7, however I require html tags within the title.

For e.g:

    $tabs_project['backers'] = array(
        'title' => t('Backers').'strong'.$backers_total.'strong',
        'contents' => 'backer information..',
        'weight' => 2,      

But this prints out the strong tags too.. Any ideas? (couldn't work out how to put the correct html tags in the pre tags, so left it as 'strong')

Cheers in advance,

share|improve this question

Turns out you can apply something like so:

$qt_project['content']['content']['tabs']['tablinks']['backers']['#options']['html'] = TRUE;

thanks to comment on drupal forum


share|improve this answer
This should be right – darol100 Dec 15 '14 at 6:39

A solution that avoids patching the module would be to override the appropriate theme function that outputs the "tabset" tab titles. For the quicktab style, a solution would look like this:

 * Overrides Theme function to output tablinks for classic Quicktabs style tabs.
function YOUR_THEME_NAME_qt_quicktabs_tabset($vars) {
  $variables = array(
    'attributes' => array(
      'class' => 'quicktabs-tabs quicktabs-style-' . $vars['tabset']['#options']['style'],
    'items' => array(),
  foreach (element_children($vars['tabset']['tablinks']) as $key) {
    $item = array();
    if (is_array($vars['tabset']['tablinks'][$key])) {
      $tab = $vars['tabset']['tablinks'][$key];
      $tab['#options']['html'] = TRUE; // Added this to override to allow HTML in titles.
      if ($key == $vars['tabset']['#options']['active']) {
        $item['class'] = array('active');
      $item['data'] = drupal_render($tab);
      $variables['items'][] = $item;
  return theme('item_list', $variables);

See the Quicktabs.module theme functions for reference here: http://drupalcode.org/project/quicktabs.git/blob/refs/heads/7.x-3.x:/quicktabs.module#l591

I crossposted this in this comment on d.o: https://drupal.org/comment/8343639#comment-8343639

share|improve this answer

You can implement a "process" function for the qt_quicktabs_tabset theme-hook in your custom module like this:

function MYMODULE_process_qt_quicktabs_tabset(&$vars) {
  // Allow HTML in quicktab titles.
  foreach (element_children($vars['tabset']['tablinks']) as $key) {
    if (is_array($vars['tabset']['tablinks'][$key])) {
      $vars['tabset']['tablinks'][$key]['#options']['html'] = TRUE;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.