The Quick Tabs module allows you to create blocks of tabbed content. You can create a block on your site containing up to six tabs with corresponding content. Clicking on the tabs makes the corresponding content display instantly (it uses jQuery). The content for each tabbed section can be either a view or an existing block. It is an ideal way to do something like the Most Popular / Most Emailed stories tabs you see on many news websites.
Once created, the Quick Tabs blocks show up in your block listing, ready to be configured and enabled like other blocks.
Multiple Quick Tabs blocks can be placed on a single page.
Visit the Quick Tabs configuration page to choose a style for your Quick Tabs blocks.
Click on the "New QT block" tab below to get started.
', array('@configuration' => url('admin/settings/quicktabs'))); case 'admin/build/quicktabs/add': return ''. t('Here you can create a new Quick Tabs block. Once you have created this block you will be taken to the blocks page to configure and enable it.', array('@overview' => url('admin/build/block'))) .'
'; } } function quicktabs_theme() { return array( 'quicktabs_settings' => array( 'arguments' => array('form' => NULL), ), 'quicktabs_preview_page' => array( 'arguments' => array(), ), 'qt_tabs' => array( 'arguments' => array('form' => NULL), ), 'quicktabs_block' => array( 'arguments' => array('block', 'title' => TRUE), ), 'quicktabs_tabs' => array( 'arguments' => array('tabs'), ), ); } /** * Implementation of hook_menu(). */ function quicktabs_menu() { $items = array(); $items['admin/build/quicktabs'] = array( 'title' => 'Quick Tabs', 'description' => 'Create blocks of tabbed content - content for each tab can be a view or a block', 'page callback' => 'quicktabs_list', 'access arguments' => array('administer quicktabs blocks'), ); $items['admin/build/quicktabs/list'] = array( 'title' => 'List', 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10); $items['admin/build/quicktabs/add'] = array( 'title' => 'New QT block', 'access arguments' => array('create quicktabs block'), 'page callback' => 'quicktabs_new', 'type' => MENU_LOCAL_TASK); $items['admin/build/quicktabs/delete'] = array( 'title' => 'Delete QT block', 'access arguments' => array('administer blocks'), 'page callback' => 'drupal_get_form', 'page arguments' => array('quicktabs_block_delete'), 'type' => MENU_CALLBACK); $items['admin/build/quicktabs/edit'] = array( 'title' => 'Edit QT block', 'access arguments' => array('administer blocks'), 'page callback' => 'quicktabs_block_edit', 'type' => MENU_CALLBACK); $items['admin/settings/quicktabs'] = array( 'title' => 'Quick Tabs', 'description' => 'Select a style for your Quick Tabs blocks', 'page callback' => 'drupal_get_form', 'page arguments' => array('quicktabs_settings'), 'type' => MENU_NORMAL_ITEM, 'access arguments' => array('administer site configuration'), ); $items['quicktabs/preview'] = array( 'page callback' => 'quicktabs_preview_page', 'type' => MENU_CALLBACK, 'access arguments' => array('administer site configuration'), ); $items['quicktabs/ahah'] = array( 'page callback' => 'quicktabs_ahah', 'type' => MENU_CALLBACK, 'access arguments' => array('administer site configuration'), ); return $items; } /** * Implementation of hook_perm(). */ function quicktabs_perm() { return array('create quicktabs block', 'administer quicktabs blocks'); } function quicktabs_list() { $result = db_query('SELECT * FROM {quicktabs}'); $header = array(t('Quick Tabs Block Name'), t('Delete')); $rows = array(); while ($row = db_fetch_object($result)) { $tablerow = array( array('data' => $row->title .' ('. l('edit', 'admin/build/quicktabs/edit/'. $row->qtid) .')'), array('data' => l(t('Delete'), 'admin/build/quicktabs/delete/'. $row->qtid)), ); $rows[] = $tablerow; } $output = theme('table', $header, $rows, array('id' => 'quicktabs')); return $output; } function quicktabs_new() { drupal_add_js(drupal_get_path('module', 'quicktabs') .'/js/quicktabs_form.js'); drupal_add_css(drupal_get_path('module', 'quicktabs') .'/quicktabs.css'); return drupal_get_form('quicktabs_form'); } /** * build the Quick Tabs creation and edit form */ function quicktabs_form($form_state = NULL, $quicktabs = NULL) { // Add our JS file, which has some Drupal core JS overrides, and ensures ahah behaviours get re-attached drupal_add_js(drupal_get_path('module', 'quicktabs') . '/js/quicktabs_ahah.js', 'footer'); $form = array( '#cache' => TRUE, ); // the contents of $quicktabs will either come from the db or from $form_state if (isset($form_state['quicktabs'])) { $quicktabs = $form_state['quicktabs'] + (array)$quicktabs; } $form['title'] = array( '#title' => t('Block Title'), '#type' => 'textfield', '#description' => t('The title of the whole block'), '#default_value' => ($quicktabs['title'] ? $quicktabs['title'] : ''), '#weight' => -5 ); $tabcontent = $quicktabs['tabs']; $formtype = $quicktabs['formtype']; if ($formtype == 'edit') { $form['qtid'] = array( '#type' => 'hidden', '#value' => $quicktabs['qtid'] ); } if (isset($form_state['qt_count'])) { $qt_count = $form_state['qt_count']; } else { $qt_count = max(2, empty($tabcontent) ? 2 : count($tabcontent)); } // Add a wrapper for the tabs and Add Another Tab button. $form['qt_wrapper'] = array( '#tree' => FALSE, '#weight' => -4, '#prefix' => '