You are here

function views_filterfield::options_form in Views Filter Field 7

Default options form provides the label widget that all fields should have.

Overrides views_handler_field::options_form

File

handlers/views_filterfield.inc, line 20

Class

views_filterfield
Views area form input field handler.

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);
  $filters = $this
    ->get_filter();
  foreach ($filters as $filter => $handler) {
    $title = empty($handler->options['ui_name']) ? t('@group: @title', array(
      '@group' => $handler->definition['group'],
      '@title' => $handler->definition['title'],
    )) : $handler->options['ui_name'];
    $options[$filter] = check_plain($title);
  }
  $form['views_filterfield_field'] = array(
    '#type' => 'select',
    '#title' => t('Filter'),
    '#description' => t('Select the filter whose value you want to display.'),
    '#options' => $options,
    '#default_value' => $this->options['views_filterfield_field'],
    '#required' => TRUE,
  );
  $form['views_filterfield_separator'] = array(
    '#type' => 'radios',
    '#title' => t('Multiple value display'),
    '#description' => t('How should multiple values be displayed? This can affect how a value is passed to an embedded view.'),
    '#options' => array(
      '+' => t('1+2+3 (for OR)'),
      ',' => t('1,2,3 (for AND)'),
    ),
    '#default_value' => $this->options['views_filterfield_separator'],
    '#required' => TRUE,
  );

  // The options array here is in a weird order so that the list matches
  // what Views uses and the 6 users who had already downloaded this module
  // don't suddenly get the wrong transform.
  $form['views_filterfield_case'] = array(
    '#type' => 'radios',
    '#title' => t('Text case'),
    '#description' => t('Do you want to change the text case of the generated filter string?'),
    '#options' => array(
      0 => t('No transform'),
      3 => t('Upper case'),
      1 => t('Lower case'),
      4 => t('Capitalize first letter'),
      2 => t('Capitalize each word'),
    ),
    '#default_value' => $this->options['views_filterfield_case'],
    '#required' => TRUE,
  );
  $form['views_filterfield_transform_dash'] = array(
    '#type' => 'checkbox',
    '#title' => t('Transform spaces to dashes'),
    '#value' => 1,
    '#default_value' => $this->options['views_filterfield_transform_dash'],
    '#required' => FALSE,
  );
}