You are here

public function UrlPath::validateOptionsForm 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::validateOptionsForm()
  2. 8 src/Plugin/views/argument_validator/UrlPath.php \Drupal\views_url_path_arguments\Plugin\views\argument_validator\UrlPath::validateOptionsForm()

Provide the default form form for validating options

Overrides ArgumentDefaultPluginBase::validateOptionsForm

File

src/Plugin/views/argument_default/UrlPath.php, line 109

Class

UrlPath
Convert an entity id to its url path.

Namespace

Drupal\views_url_path_arguments\Plugin\views\argument_default

Code

public function validateOptionsForm(&$form, FormStateInterface $form_state) {
  $values = $form_state
    ->getValue($form['#parents']);
  if (isset($values['segments']) && $values['segments'] !== trim($values['segments'], '/')) {
    $form_state
      ->setError($form['segments'], t('The URL segments must not contain a leading or trailing slash (/).'));
  }
}