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

Build the options form.

Overrides views_handler_argument::options_form

File

core/modules/views/handlers/views_handler_argument_string.inc, line 42
Definition of views_handler_argument_string.

Class

views_handler_argument_string
Basic argument handler to implement string arguments that may have length limits.

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);

  $form['glossary'] = array(
    '#type' => 'checkbox',
    '#title' => t('Glossary mode'),
    '#description' => t('Glossary mode applies a limit to the number of characters used in the filter value, which allows the summary view to act as a glossary.'),
    '#default_value' => $this->options['glossary'],
    '#fieldset' => 'more',
  );

  $form['limit'] = array(
    '#type' => 'textfield',
    '#title' => t('Character limit'),
    '#description' => t('How many characters of the filter value to filter against. If set to 1, all fields starting with the first letter in the filter value would be matched.'),
    '#default_value' => $this->options['limit'],
    '#states' => array(
      'visible' => array(
        ':input[name="options[glossary]"]' => array('checked' => TRUE),
      ),
    ),
    '#fieldset' => 'more',
  );

  $form['case'] = array(
    '#type' => 'select',
    '#title' => t('Case'),
    '#description' => t('When printing the title and summary, how to transform the case of the filter value.'),
    '#options' => array(
      'none' => t('No transform'),
      'upper' => t('Upper case'),
      'lower' => t('Lower case'),
      'ucfirst' => t('Capitalize first letter'),
      'ucwords' => t('Capitalize each word'),
    ),
    '#default_value' => $this->options['case'],
    '#fieldset' => 'more',
  );

  $form['transform_dash'] = array(
    '#type' => 'checkbox',
    '#title' => t('Transform spaces to dashes in URL'),
    '#default_value' => $this->options['transform_dash'],
    '#fieldset' => 'more',
  );

  if (!empty($this->definition['many to one'])) {
    $form['add_table'] = array(
      '#type' => 'checkbox',
      '#title' => t('Allow multiple filter values to work together'),
      '#description' => t('If selected, multiple instances of this filter can work together, as though multiple values were supplied to the same filter. This setting is not compatible with the "Reduce duplicates" setting.'),
      '#default_value' => !empty($this->options['add_table']),
      '#fieldset' => 'more',
    );

    $form['require_value'] = array(
      '#type' => 'checkbox',
      '#title' => t('Do not display items with no value in summary'),
      '#default_value' => !empty($this->options['require_value']),
      '#fieldset' => 'more',
    );
  }

  // allow + for or, , for and
  $form['break_phrase'] = array(
    '#type' => 'checkbox',
    '#title' => t('Allow multiple values'),
    '#description' => t('If selected, users can enter multiple values in the form of 1+2+3 (for OR) or 1,2,3 (for AND).'),
    '#default_value' => !empty($this->options['break_phrase']),
    '#fieldset' => 'more',
  );
}