public function String::buildOptionsForm

Build the options form.

Overrides ArgumentPluginBase::buildOptionsForm

1 call to String::buildOptionsForm()
ListString::buildOptionsForm in drupal/core/modules/field/lib/Drupal/field/Plugin/views/argument/ListString.php
Build the options form.
1 method overrides String::buildOptionsForm()
ListString::buildOptionsForm in drupal/core/modules/field/lib/Drupal/field/Plugin/views/argument/ListString.php
Build the options form.

File

drupal/core/modules/views/lib/Drupal/views/Plugin/views/argument/String.php, line 55
Definition of Drupal\views\Plugin\views\argument\String.

Class

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

Namespace

Drupal\views\Plugin\views\argument

Code

public function buildOptionsForm(&$form, &$form_state) {
  parent::buildOptionsForm($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['path_case'] = array(
    '#type' => 'select',
    '#title' => t('Case in path'),
    '#description' => t('When printing url paths, how to transform the case of the filter value. Do not use this unless with Postgres as it uses case sensitive comparisons.'),
    '#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['path_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',
  );
}