'admin/settings/tabs', 'title' => t('Tabs'), 'description' => t('Configuration for tabs'), 'callback' => 'drupal_get_form', 'callback arguments' => array('tabs_admin_settings') ); } else { tabs_load(); } return $items; } /** * Menu callback for admin settings. */ function tabs_admin_settings() { $form = array(); $form['tabs_slide'] = array( '#type' => 'radios', '#title' => t('Slide effect'), '#description' => t('Apply slide effect when changing tabs.'), '#default_value' => variable_get('tabs_slide', 0), '#options' => array(t('disabled'), t('enabled')), ); $form['tabs_fade'] = array( '#type' => 'radios', '#title' => t('Fade effect'), '#description' => t('Apply fade effect when changing tabs.'), '#default_value' => variable_get('tabs_fade', 0), '#options' => array(t('disabled'), t('enabled')), ); $form['tabs_speed'] = array( '#type' => 'radios', '#title' => t('Effect speed'), '#description' => t('Speed at which to apply effects.'), '#default_value' => variable_get('tabs_speed', 'slow'), '#options' => array('slow' => t('slow'), 'fast' => t('fast')), ); $form['tabs_auto_height'] = array( '#type' => 'radios', '#title' => t('Fixed height'), '#description' => t('Set all tabs to have the height of the tallest tab. If not enabled, content will adjust to fit when tabs are changed. Note: fixed height is not fully compatible with slide and fade effects.'), '#default_value' => variable_get('tabs_auto_height', 0), '#options' => array(t('disabled'), t('enabled')), ); $form = system_settings_form($form); return $form; } function tabs_process_tabset($element) { static $names = array(); // Ensure name is unique. $i = 0; // Assign a name, reading from the first parent (the key of this tabset element). $name = $element['#tabset_name'] = ($element['#tabset_name'] ? $element['#tabset_name'] : (isset($element['#parents']) && count($element['#parents']) ? $element['#parents'][0] : 'tabset')); // In case we have duplicate names... while (in_array($element['#tabset_name'], $names)) { $element['#tabset_name'] = $name . $i; $i++; } $names[] = $element['#tabset_name']; $index = 1; // Sort the elements by weight. uasort($element, "_element_sort"); foreach (element_children($element) as $key) { if (isset($element[$key]['#type']) && $element[$key]['#type'] == 'tabpage') { $element[$key]['#tabset_name'] = $element['#tabset_name']; $element[$key]['#index'] = $index++; } } return $element; } function theme_tabset($element) { $output .= '