Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

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
add comment

2 Answers

Turns out you can apply something like so:

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

thanks to #6> http://drupal.org/node/1533410

cheers

share|improve this answer
add comment

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
add comment

Your Answer

 
discard

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.