function Raw::buildOptionsForm

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

Overrides ArgumentDefaultPluginBase::buildOptionsForm

File

core/modules/views/src/Plugin/views/argument_default/Raw.php, line 85

Class

Raw
Default argument plugin to use the raw value from the URL.

Namespace

Drupal\views\Plugin\views\argument_default

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
    parent::buildOptionsForm($form, $form_state);
    $form['index'] = [
        '#type' => 'select',
        '#title' => $this->t('Path component'),
        '#default_value' => $this->options['index'],
        // range(1, 10) returns an array with:
        // - keys that count from 0 to match PHP array keys from explode().
        // - values that count from 1 for display to humans.
'#options' => range(1, 10),
        '#description' => $this->t('The numbering starts from 1, e.g. on the page admin/structure/types, the 3rd path component is "types".'),
    ];
    $form['use_alias'] = [
        '#type' => 'checkbox',
        '#title' => $this->t('Use path alias'),
        '#default_value' => $this->options['use_alias'],
        '#description' => $this->t('Use path alias instead of internal path.'),
    ];
}

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