';
$output .= '
';
$index = 1;
foreach ($tabs as $tab) {
$output .= theme('tabs_page', $index, $tab);
$index++;
}
$output .= '';
return $output;
}
function theme_tabs_page($index, $tab) {
$output .='';
$output .= '
'. $tab['#title'] .'
';
$output .= $tab['#content'];
$output .='';
return $output;
}
/**
* Implementation of hook_menu().
*/
function tabs_menu($may_cache) {
$items = array();
if ($may_cache) {
$items[] = array(
'path' => 'tabs/example',
'title' => t('tabs example'),
'callback' => 'tabs_example',
'access' => TRUE,
'type' => MENU_CALLBACK
);
}
return $items;
}
/**
* Example of tabs construction.
*/
function tabs_example() {
$tabs = array();
$tabs[] = array(
'#title' => t('One'),
'#content' => t('First tab content.'),
);
$tabs[] = array(
'#title' => t('Two'),
'#content' => t('Second tab content.'),
);
$tabs[] = array(
'#title' => t('Three'),
'#content' => t('Third tab content.'),
);
return theme('tabs_tabset', $tabs);
}
/**
* Add required js and css files.
*/
function tabs_load() {
$path = drupal_get_path('module', 'tabs');
drupal_add_js($path . '/jquery.tabs.js');
drupal_add_js($path . '/tabs.js');
drupal_add_css($path . '/drupal-tabs.css');
drupal_add_css($path . '/tabs.css');
drupal_set_html_head('
');
}