function Context::validate

Same name in this branch
  1. 11.x core/lib/Drupal/Core/Plugin/Context/Context.php \Drupal\Core\Plugin\Context\Context::validate()
Same name in other branches
  1. 9 core/lib/Drupal/Core/Plugin/Context/Context.php \Drupal\Core\Plugin\Context\Context::validate()
  2. 9 core/lib/Drupal/Component/Plugin/Context/Context.php \Drupal\Component\Plugin\Context\Context::validate()
  3. 8.9.x core/lib/Drupal/Core/Plugin/Context/Context.php \Drupal\Core\Plugin\Context\Context::validate()
  4. 8.9.x core/lib/Drupal/Component/Plugin/Context/Context.php \Drupal\Component\Plugin\Context\Context::validate()
  5. 10 core/lib/Drupal/Core/Plugin/Context/Context.php \Drupal\Core\Plugin\Context\Context::validate()
  6. 10 core/lib/Drupal/Component/Plugin/Context/Context.php \Drupal\Component\Plugin\Context\Context::validate()

Overrides ContextInterface::validate

1 method overrides Context::validate()
Context::validate in core/lib/Drupal/Core/Plugin/Context/Context.php
Validates the set context value.

File

core/lib/Drupal/Component/Plugin/Context/Context.php, line 88

Class

Context
A generic context class for wrapping data a plugin needs to operate.

Namespace

Drupal\Component\Plugin\Context

Code

public function validate() {
    $validator = Validation::createValidatorBuilder()->getValidator();
    return $validator->validateValue($this->getContextValue(), $this->getConstraints());
}

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