1 views_plugin_exposed_form.inc views_plugin_exposed_form::options_form(&$form, &$form_state)

Provide a form to edit options for this plugin.

Overrides views_plugin::options_form

File

core/modules/views/plugins/views_plugin_exposed_form.inc, line 52
Definition of views_plugin_exposed_form.

Class

views_plugin_exposed_form
The base plugin to handle exposed filter forms.

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);
  $form['submit_button'] = array(
    '#type' => 'textfield',
    '#title' => t('Submit button text'),
    '#description' => t('Text to display in the submit button of the exposed form.'),
    '#default_value' => $this->options['submit_button'],
    '#required' => TRUE,
  );

  $form['reset_button'] = array(
    '#type' => 'checkbox',
    '#title' => t('Include reset button'),
    '#description' => t('If checked the exposed form will provide a button to reset all the applied exposed filters'),
    '#default_value' => $this->options['reset_button'],
  );

  $form['reset_button_label'] = array(
    '#type' => 'textfield',
    '#title' => t('Reset button label'),
    '#description' => t('Text to display in the reset button of the exposed form.'),
    '#default_value' => $this->options['reset_button_label'],
    '#required' => TRUE,
    '#states' => array(
      'invisible' => array(
        'input[name="exposed_form_options[reset_button]"]' => array('checked' => FALSE),
      ),
    ),
  );

  $form['exposed_sorts_label'] = array(
    '#type' => 'textfield',
    '#title' => t('Exposed sorts label'),
    '#description' => t('Text to display as the label of the exposed sort select box.'),
    '#default_value' => $this->options['exposed_sorts_label'],
    '#required' => TRUE,
  );

  $form['expose_sort_order'] = array(
    '#type' => 'checkbox',
    '#title' => t('Expose sort order'),
    '#description' => t('Allow the user to choose the sort order. If sort order is not exposed, the sort criteria settings for each sort will determine its order.'),
    '#default_value' => $this->options['expose_sort_order'],
  );

  $form['sort_asc_label'] = array(
    '#type' => 'textfield',
    '#title' => t('Ascending'),
    '#description' => t('Text to use when exposed sort is ordered ascending.'),
    '#default_value' => $this->options['sort_asc_label'],
    '#required' => TRUE,
    '#states' => array(
      'visible' => array(
        'input[name="exposed_form_options[expose_sort_order]"]' => array('checked' => TRUE),
      ),
    ),
  );

  $form['sort_desc_label'] = array(
    '#type' => 'textfield',
    '#title' => t('Descending'),
    '#description' => t('Text to use when exposed sort is ordered descending.'),
    '#default_value' => $this->options['sort_desc_label'],
    '#required' => TRUE,
    '#states' => array(
      'visible' => array(
        'input[name="exposed_form_options[expose_sort_order]"]' => array('checked' => TRUE),
      ),
    ),
  );

  $form['autosubmit'] = array(
    '#type' => 'checkbox',
    '#title' => t('Autosubmit'),
    '#description' => t('Automatically submit the form once an element is changed.'),
    '#default_value' => $this->options['autosubmit'],
  );

  $form['autosubmit_hide'] = array(
    '#type' => 'checkbox',
    '#title' => t('Hide submit button'),
    '#description' => t('Hide submit button if javascript is enabled.'),
    '#default_value' => $this->options['autosubmit_hide'],
    '#states' => array(
      'invisible' => array(
        'input[name="exposed_form_options[autosubmit]"]' => array('checked' => FALSE),
      ),
    ),
  );
}