You are here

public function Context::validate in Plug 7

Validates the set context value.

Return value

\Symfony\Component\Validator\ConstraintViolationListInterface A list of constraint violations. If the list is empty, validation succeeded.

Overrides ContextInterface::validate

File

lib/Drupal/Component/Plugin/Context/Context.php, line 93
Contains \Drupal\Component\Plugin\Context\Context.

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());
}