You are here

public function Raw::buildOptionsForm in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Plugin/views/argument_default/Raw.php \Drupal\views\Plugin\views\argument_default\Raw::buildOptionsForm()

Provide the default form for setting options.

Overrides ArgumentDefaultPluginBase::buildOptionsForm

File

core/modules/views/src/Plugin/views/argument_default/Raw.php, line 91
Contains \Drupal\views\Plugin\views\argument_default\Raw.

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'] = array(
    '#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'] = array(
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Use path alias'),
    '#default_value' => $this->options['use_alias'],
    '#description' => $this
      ->t('Use path alias instead of internal path.'),
  );
}