array( 'render element' => 'quicktabs_tabstyle', ), ); } /** * Implements hook_menu(). */ function quicktabs_tabstyles_menu() { $items['admin/structure/quicktabs/styles'] = array( 'title' => 'Styles', 'page callback' => 'drupal_get_form', 'page arguments' => array('quicktabs_tabstyles_styles'), 'access arguments' => array('administer quicktabs'), 'type' => MENU_LOCAL_TASK, ); return $items; } /** * Callback function for admin/structure/quicktabs/styles. The style chooser form. */ function quicktabs_tabstyles_styles() { $options = array(); $styles = module_invoke_all('quicktabs_tabstyles'); // The keys used for options must be valid html id-s. // Removing the css file path, because that can't be used. foreach ($styles as $style) { $options[$style] = $style; } ksort($options); $form['quicktabs_tabstyle'] = array( '#type' => 'radios', '#title' => t('Quicktab styles'), '#options' => array('nostyle' => t('No style')) + $options, '#default_value' => variable_get('quicktabs_tabstyle', 'nostyle'), '#description' => t('Select the default style for quicktabs.'), '#attributes' => array('class' => array('quicktabs-tabstyles', 'clear-block')), '#theme' => 'quicktabs_style_options', ); $form['submit'] = array( '#type' => 'submit', '#value' => t('Save'), ); return $form; } /** * Submit handler for QuickTabs styles. */ function quicktabs_tabstyles_styles_submit($form, &$form_state) { variable_set('quicktabs_tabstyle', $form_state['values']['quicktabs_tabstyle']); drupal_set_message(t('The default quicktab style has been saved.')); } /** * Theme function for quicktabs style radio options. * * @ingroup themeable */ function theme_quicktabs_style_options($variables) { $style_element = $variables['quicktabs_tabstyle']; $markup = ''; $tabs = array( array('title' => t('One'), 'contents' => array('#markup' => t('First tab')), 'weight' => 0), array('title' => t('Two'), 'contents' => array('#markup' => t('Second tab')), 'weight' => 1), array('title' => t('Three'), 'contents' => array('#markup' => t('Third tab')), 'weight' => 2) ); $options = array('renderer' => 'quicktabs', 'hide_empty_tabs' => 0, 'ajax' => 0); // Preview for each style. foreach (element_children($style_element) as $style) { $element = $style_element[$style]; $options['style'] = $style; $quicktabs = quicktabs_build_quicktabs(drupal_strtolower($style), $options, $tabs); $preview = '