You are here

function quicktabs_style_plugin::options_form in Quick Tabs 7.3

Same name and namespace in other branches
  1. 6.3 includes/quicktabs_style_plugin.inc \quicktabs_style_plugin::options_form()
  2. 6.2 includes/quicktabs_style_plugin.inc \quicktabs_style_plugin::options_form()

Provide a form to edit options for this plugin.

Overrides views_plugin_style::options_form

File

includes/quicktabs_style_plugin.inc, line 23
Add Quicktabs style plugins to Views.

Class

quicktabs_style_plugin
Style plugin to display Quicktabs.

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);
  $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['tab_style'] = array(
    '#type' => 'select',
    '#title' => t('Tab style'),
    '#options' => array(
      'nostyle' => t('No style'),
      'default' => t('Default style'),
    ) + $options,
    '#default_value' => $this->options['tab_style'],
    '#description' => t('The tab style that will be applied to this set of tabs. Note that this style may not show in the live preview.'),
    '#weight' => -5,
  );
  if (isset($form['grouping'])) {
    $options = array();
    foreach (element_children($form['grouping']) as $key => $value) {
      if (!empty($form['grouping'][$key]['field']['#options']) && is_array($form['grouping'][$key]['field']['#options'])) {
        $options = array_merge($options, $form['grouping'][$key]['field']['#options']);
      }
    }
    unset($options['']);
    $form['tab_title_field'] = array(
      '#type' => 'select',
      '#title' => t('Title field'),
      '#options' => $options,
      '#required' => TRUE,
      '#default_value' => $this->options['tab_title_field'],
      '#description' => t('Select the field that will be used as the tab title.'),
      '#weight' => -3,
    );
  }
}