2

I'm trying to create some QuickTabs programmatically like it's documented on the website, but for some reason, my code bellow doesn't generate QuickTabs at all!
What do I do wrong or am I looking at the wrong documentation here?

function quicktabsmenu_block_info() {
  $blocks['quicktabsmenu'] = array(
    'info' => t('Dynamic QuickTabs menu'), 
    'cache' => DRUPAL_NO_CACHE,
  );
  return $blocks;
}

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

  switch ($delta) {
    case 'quicktabsmenu':
       //set tab content
        $block['subject'] = t('Syndicate');
        $block['content'] = _create_quicktabs();
        return $block;
      break;
  }
  return $block;
}

function _create_quicktabs() {
  $tabs['tabcontent'] = array(
    'title' => t('Tab 1'),
    'type' => 'freetext',
    'text' => t('Free text'),
  );
  $quicktabs['qtid'] = 'my_new_quicktabs';
  $quicktabs['tabs'] = $tabs;
  $quicktabs['style'] = 'Zen';
  $quicktabs['ajax'] = FALSE;;
  $var = theme('quicktabs', $quicktabs);
  return $var;
}

2 Answers 2

3

Well, after some thinking and searching, I managed to solve my own question. All I needed was this:

$tabs = array(
   $tabs[] = array(
      'title'   => t('Tab one'),
      'type'    => 'node',
      'nid'     => '24',
      'weight'  => 0,
    ),
    $tabs[] = array(
      'title'   => t('Tab two'),
      'type'    => 'node',
      'nid'     => '23',
      'weight'  => 1,
    ),
);

// Configure the QuickTabs options
$quicktabs_options = array(
   'style'   => 'Bullets',
   'ajax'    => FALSE,
);

$quicktabs_name = 'dynamic_quicktabs_menu';
$quicktabs = quicktabs_build_quicktabs($quicktabs_name, $quicktabs_options, $tabs);
return $quicktabs;
0

So, where have you added this code (I'm new to drupal so would appreciate if you could tell me the filename where this code is to be added)

1
  • Typically you would put this in a module.
    – user5013
    Commented Sep 25, 2013 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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