You are here

public function UrlPath::buildOptionsForm in Views URL Path Arguments 8

Same name in this branch
  1. 8 src/Plugin/views/argument_default/UrlPath.php \Drupal\views_url_path_arguments\Plugin\views\argument_default\UrlPath::buildOptionsForm()
  2. 8 src/Plugin/views/argument_validator/UrlPath.php \Drupal\views_url_path_arguments\Plugin\views\argument_validator\UrlPath::buildOptionsForm()

Provides the default form for setting options.

Overrides ArgumentValidatorPluginBase::buildOptionsForm

File

src/Plugin/views/argument_validator/UrlPath.php, line 85

Class

UrlPath
Convert an entity id to its url path.

Namespace

Drupal\views_url_path_arguments\Plugin\views\argument_validator

Code

public function buildOptionsForm(&$form, FormStateInterface $formState) {
  $form['provide_static_segments'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Provide a static URL segment as the prefix to the alias?'),
    '#default_value' => $this->options['provide_static_segments'],
  ];
  $form['segments'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Segments'),
    '#description' => $this
      ->t('Without leading and/or trailing slashes.'),
    '#default_value' => $this->options['segments'],
    '#states' => [
      'visible' => [
        ':input[name="options[argument_default][views_url_path][provide_static_segments]"]' => [
          'checked' => TRUE,
        ],
      ],
    ],
  ];
}