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'))) .'
'; } } /** * Implementation of hook_menu(). */ function quicktabs_menu($may_cache) { $items = array(); if ($may_cache) { $items[] = array( 'path' => 'admin/build/quicktabs', 'title' => t('Quick Tabs'), 'description' => t('Create blocks of tabbed content - content for each tab can be a view or a block'), 'callback' => 'quicktabs_list', 'access' => user_access('administer quicktabs blocks'), ); $items[] = array('path' => 'admin/build/quicktabs/list', 'title' => t('List'), 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10); $items[] = array( 'path' => 'admin/build/quicktabs/add', 'title' => t('New QT block'), 'access' => user_access('create quicktabs block'), 'callback' => 'quicktabs_new', 'type' => MENU_LOCAL_TASK); $items[] = array('path' => 'admin/build/quicktabs/delete', 'title' => t('Delete QT block'), 'access' => user_access('administer blocks'), 'callback' => 'drupal_get_form', 'callback arguments' => array('quicktabs_block_delete'), 'type' => MENU_CALLBACK); $items[] = array('path' => 'admin/build/quicktabs/edit', 'title' => t('Edit QT block'), 'access' => user_access('administer blocks'), 'callback' => 'quicktabs_block_edit', 'type' => MENU_CALLBACK); $items[] = array( 'path' => 'admin/settings/quicktabs', 'title' => t('Quick Tabs'), 'description' => t('Select a style for your Quick Tabs blocks'), 'callback' => 'drupal_get_form', 'callback arguments' => array('quicktabs_settings'), 'type' => MENU_NORMAL_ITEM, 'access' => user_access('administer site configuration'), ); $items[] = array( 'path' => 'quicktabs/preview', 'callback' => 'quicktabs_preview_page', 'type' => MENU_CALLBACK, 'access' => user_access('administer site configuration'), ); } else { quicktabs_set_js(); } 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'); } function quicktabs_get_views() { views_load_cache(); $result = db_query("SELECT v.name, v.description, f.field FROM {view_view} v LEFT JOIN {view_exposed_filter} f ON v.vid=f.vid"); $views = array(); while ($view = db_fetch_object($result)) { if (!($view->field)) { $views[$view->name] = $view->name .': '. $view->description; } } $default_views = _views_get_default_views(); $views_status = variable_get('views_defaults', array()); foreach ($default_views as $view) { if (!$views[$view->name] && ($views_status[$view->name] == 'enabled' || (!$views_status[$view->name] && !$view->disabled)) && empty($view->exposed_filter)) { $views[$view->name] = check_plain($view->name .': '. $view->description); } } return $views; } function quicktabs_get_blocks() { $blocks = _block_rehash(); $blocksarray = array(); foreach ($blocks as $i => $block) { if ($block['module'] != 'quicktabs') { $key = $block['module'] .'_delta_'. $block['delta']; $blocksarray[$key] = $block['info']; } } return $blocksarray; } function quicktabs_form($form_values = NULL) { if(stristr($_POST['op'], 'remove_')) { $tab_to_remove = intval(substr($_POST['op'], 7)); } $changed = FALSE; $form = array( '#cache' => TRUE, ); $form['title'] = array( '#title' => t('Block Title'), '#type' => 'textfield', '#description' => t('The title of the whole block'), '#default_value' => isset($form_values['title']) ? $form_values['title'] : '', '#weight' => -5 ); $formtype = $form_values['formtype'] ? $form_values['formtype'] : 'new'; $form['formtype'] = array( '#type' => 'hidden', '#value' => $formtype ); if ($formtype == 'edit') { $form['qtid'] = array( '#type' => 'hidden', '#value' => $form_values['qtid'] ); } if (isset($form_values)) { $tabcontent = $form_values['tabs']; if(isset($tab_to_remove) && ($tab_to_remove <= count($tabcontent))) { unset($tabcontent[$tab_to_remove]); $tabcontent = array_values($tabcontent); unset($_POST); unset($tab_to_remove); $changed = TRUE; } } if (isset($_POST['num_tabs'])) { if ($_POST['op'] == 'More tabs' && isset($_POST['new_tabs'])) { $qt_count = $_POST['num_tabs'] + $_POST['new_tabs']; unset($_POST['new_tabs']); } elseif (isset($tab_to_remove)) { $qt_count = $_POST['num_tabs'] - 1; } else { $qt_count = $_POST['num_tabs']; } } else { $qt_count = max(2, empty($tabcontent) ? 2 : count($tabcontent)); } $form['num_tabs'] = array( '#type' => 'hidden', '#value' => $qt_count, ); // Add a wrapper for the tabs and Add More Tabs button. $form['qt_wrapper'] = array( '#tree' => FALSE, '#weight' => -4, '#prefix' => '