function QueryParameter::buildOptionsForm

Same name and namespace in other branches
  1. 9 core/modules/views/src/Plugin/views/argument_default/QueryParameter.php \Drupal\views\Plugin\views\argument_default\QueryParameter::buildOptionsForm()
  2. 8.9.x core/modules/views/src/Plugin/views/argument_default/QueryParameter.php \Drupal\views\Plugin\views\argument_default\QueryParameter::buildOptionsForm()
  3. 11.x core/modules/views/src/Plugin/views/argument_default/QueryParameter.php \Drupal\views\Plugin\views\argument_default\QueryParameter::buildOptionsForm()

Overrides ArgumentDefaultPluginBase::buildOptionsForm

File

core/modules/views/src/Plugin/views/argument_default/QueryParameter.php, line 37

Class

QueryParameter
A query parameter argument default handler.

Namespace

Drupal\views\Plugin\views\argument_default

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
    parent::buildOptionsForm($form, $form_state);
    $form['query_param'] = [
        '#type' => 'textfield',
        '#title' => $this->t('Query parameter'),
        '#description' => $this->t('The query parameter to use.'),
        '#default_value' => $this->options['query_param'],
    ];
    $form['fallback'] = [
        '#type' => 'textfield',
        '#title' => $this->t('Fallback value'),
        '#description' => $this->t('The fallback value to use when the above query parameter is not present.'),
        '#default_value' => $this->options['fallback'],
    ];
    $form['multiple'] = [
        '#type' => 'radios',
        '#title' => $this->t('Multiple values'),
        '#description' => $this->t('Conjunction to use when handling multiple values. E.g. "?value[0]=a&value[1]=b".'),
        '#default_value' => $this->options['multiple'],
        '#options' => [
            'and' => $this->t('AND'),
            'or' => $this->t('OR'),
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.