You are here

public function Raw::buildOptionsForm in Views (for Drupal 7) 8.3

Provide the default form for setting options.

Overrides ArgumentDefaultPluginBase::buildOptionsForm

File

lib/Drupal/views/Plugin/views/argument_default/Raw.php, line 33
Definition of 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, &$form_state) {
  parent::buildOptionsForm($form, $form_state);

  // Using range(1, 10) will create an array keyed 0-9, which allows arg() to
  // properly function since it is also zero-based.
  $form['index'] = array(
    '#type' => 'select',
    '#title' => t('Path component'),
    '#default_value' => $this->options['index'],
    '#options' => range(1, 10),
    '#description' => 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' => t('Use path alias'),
    '#default_value' => $this->options['use_alias'],
    '#description' => t('Use path alias instead of internal path.'),
  );
}