How to Programmatically Create a Quicktab Block in Drupal
We often run across parts of Drupal that are not yet exportable using a tool like features.
Quicktabs is one such part. It's a neat module for a lot of Drupal sitebuilders to use. Quicktabs allows a sitebuilder to create tabbed displays of Drupal content from sources like views, blocks and nodes. Unfortunately, it is not exportable like views, boxes and content types.
However, you can programmatically create Drupal quicktab blocks using hook_block by creating a $quicktab array and pass it to theme_quicktabs().
Use the code bellow to create your quicktab array.
function mymodule_block($op = 'list', $delta = 0, $edit = array()) {
switch($op) {
case 'list':
$blocks['mymodule_quicktabs'] = array('info' => t('[mymodule] Quicktabs'));
return $blocks;
break;
case 'view':
switch ($delta) {
case 'mymodule_quicktabs':
//set tab content
$tabs['tabcontent'] = array(
'title' => t('Tab 1'),
'type' => 'freetext',
'text' => t('Free Text'),
);
$quicktabs['qtid'] = 'mymodule_quicktabs';
$quicktabs['tabs'] = $tabs;
$quicktabs['style'] = 'Zen';
$quicktabs['ajax'] = FALSE;
$block = array('subject' => '', 'content' => theme('quicktabs', $quicktabs));
return $block;
break;
}
}
}