Trying to create quick tabs programmatically in drupal 6.28 using latest quick tab module. The tabs are of type block and the contents are contained in template files located in the module folder (tab1-tab.tpl.php and tab2-tab.tpl.php). I see the tabs but no content is being displayed. Anyone know what I am missing in the code below. Any help is greatly appreciated. Thanks.

/* Implementation of hook_theme() */
function mymodule_theme($existing, $type, $theme, $path) {
return array(
'main_tab1_tab' => array(
'arguments' => array(),
'template' => 'tab1-tab'
),
'main_tab2_tab' => array(
'arguments' => array(),
'template' => 'tab2-tab'
),
'mymodule_quicktabs' => array(
'arguments' => array(),
'function' => 'mymodule_quicktabs'
)
);
}

/* Implementation of hook_block() */
function mymodule_block($op = 'list', $delta = 0, $edit = array()) {
switch($op) {
case 'list':
$blocks['tab1'] = array(
'info' => t('tab1 tab'),
'cache' => BLOCK_NO_CACHE,
'status' => TRUE,
'region' => 'content_top',
'visibility' => 1,
'pages' => '',
'title' => t('First Tab')
);
$blocks['tab2'] = array(
'info' => t('tab2 tab'),
'cache' => BLOCK_NO_CACHE,
'status' => TRUE,
'region' => 'content_top',
'visibility' => 1,
'pages' => '',
'title' => t('Second Tab')
);
$blocks['quicktabs'] = array(
'info' => t('main tabs'),
'cache' => BLOCK_NO_CACHE,
'status' => TRUE,
'region' => 'content_top',
'visibility' => 1,
'pages' => '',
'title' => ''
);
return $blocks;
case 'view':
switch($delta) {
case 'tab1':
return theme('main_tab1_tab');
case 'tab2':
return theme('main_tab2_tab');
case 'quicktabs':
return array(
'content' => theme('mymodule_quicktabs')
);
}
break;
}
}

function mymodule_quicktabs() {
$tabs['tab1'] = array(
'title' => t('Tab 1'),
'type' => 'block',
'bid' => 'mymodule_delta_tab1',
);
$tabs['tab2'] = array(
'title' => t('Tab 2'),
'type' => 'block',
'bid' => 'mymodule_delta_tab2',
);

$quicktabs = array(
'qtid' => 'mymodule_quicktabs',
'tabs' => $tabs,
'style' => 'Excel',
'ajax' => FALSE,
'hide_empty_tabs' => FALSE
);
return theme('quicktabs', $quicktabs);
}

Comments

netw3rker’s picture

Status: Active » Closed (fixed)

tabs will show if blocks return any markup, even if there is no text. your templates will need to account for that.