function ArgumentPluginBase::validateOptionsForm

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php \Drupal\views\Plugin\views\argument\ArgumentPluginBase::validateOptionsForm()
  2. 10 core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php \Drupal\views\Plugin\views\argument\ArgumentPluginBase::validateOptionsForm()
  3. 11.x core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php \Drupal\views\Plugin\views\argument\ArgumentPluginBase::validateOptionsForm()

Overrides PluginBase::validateOptionsForm

File

core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php, line 410

Class

ArgumentPluginBase
Base class for argument (contextual filter) handler plugins.

Namespace

Drupal\views\Plugin\views\argument

Code

public function validateOptionsForm(&$form, FormStateInterface $form_state) {
    $option_values =& $form_state->getValue('options');
    if (empty($option_values)) {
        return;
    }
    // Let the plugins do validation.
    $default_id = $option_values['default_argument_type'];
    $plugin = $this->getPlugin('argument_default', $default_id);
    if ($plugin) {
        $plugin->validateOptionsForm($form['argument_default'][$default_id], $form_state, $option_values['argument_default'][$default_id]);
    }
    // summary plugin
    $summary_id = $option_values['summary']['format'];
    $plugin = $this->getPlugin('style', $summary_id);
    if ($plugin) {
        $plugin->validateOptionsForm($form['summary']['options'][$summary_id], $form_state, $option_values['summary']['options'][$summary_id]);
    }
    $sanitized_id = $option_values['validate']['type'];
    // Correct ID for js sanitized version.
    $validate_id = static::decodeValidatorId($sanitized_id);
    $plugin = $this->getPlugin('argument_validator', $validate_id);
    if ($plugin) {
        $plugin->validateOptionsForm($form['validate']['options'][$default_id], $form_state, $option_values['validate']['options'][$sanitized_id]);
    }
}

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