4

The default behaviour of Quicktabs is to make accessible a block containing the tabs and the linked content. That doesn't meet my requirements, unfortunately.

Is there any way of theming Quicktabs module (7.x-3.2) in such a way, that the tabs are output in one region (eg. right sidebar in page--nodetype.tpl.php) and the linked content is displayed in the main content region? Or is it stretching the concept of tabs too far?

3

I am also trying to achieve the same result. I found this patch for an older version of quicktabs that never really got off the ground I guess.

http://drupal.org/node/1085116

I think it would be an appropriate feature.

EDIT:

Using a few ideas from the patch above, I have come up with a quick mod that splits the block into two blocks for each tab instance. Just edit your quicktabs.module as follows.

Simply add a second block definition:

function quicktabs_block_info() {
  $blocks = array();
  foreach (quicktabs_load_multiple() as $qt_name => $quicktabs) {
    $blocks[$qt_name]['info'] = $quicktabs->title;
    $blocks[$qt_name . '_qt_content']['info'] = $quicktabs->title . ' - Content';
  }
  return $blocks;
}

Then alter the block_view function as such:

function quicktabs_block_view($delta = '') {
  $block = array();

  // Check if it is the content block or not
  substr($delta, -11) == '_qt_content' ? $content_tab = 1 : $content_tab = 0;
  if($content_tab) {
    $delta = substr($delta,0, strrpos($delta, '_qt_content'));
  }

  if ($qt = quicktabs_build_quicktabs($delta)) {
    if (isset($qt['content']) && !empty($qt['content'])) {
      $block['content'] = $qt['content'];
      $block['content']['#contextual_links']['quicktabs'] = array('admin/structure/quicktabs/manage', array($delta));
      $block['subject'] = check_plain($qt['#title']);
      // remove either the tabs or content depending on the block
      if($content_tab){
        unset($block['content']['content']['tabs']);
      }else{
        unset($block['content']['content']['container']);
      }
    }
  }
  return $block;
}

It isn't the most elegant mod, but it does the job with little changes. All you have to do is add the original block (tabs) and the new contant block to wherever you want.

  • both parts of the code (--> regarding the 'function quicktabs_block_info()' and 'function quicktabs_block_view($delta = '')' <--) will have to replace the respective functions inside quicktabs.module file (which is located in .../sites/all/modules/quicktabs). Also note that this is a very hackish solution because whenever you update the quicktabs module I wonder what will happen with these modifications. – Vagelis Kostopoulos Jul 9 '13 at 8:40
2

A bit late, but I'm happy to announce that, thanks to the great suggestion here by MWay, we've created a contributed module called Quicktabs XT with some nice out-of-the-box (pun slightly intended) features such as controlling which Quicktabs should have a separated navigation through the GUI.

This saves you from having to hack the Quicktabs module, and allows you to receive updates to Quicktabs and the new Quicktabs XT module.

You can download it here:

https://www.drupal.org/project/quicktabs-xt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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