Overrides \Drupal\Component\Plugin\Context\Context::getConstraints().
Overrides Context::validate
public function validate() {
$validator = Validation::createValidatorBuilder()
->setTranslator(new DrupalTranslator())
->getValidator();
// @todo We won't need to special case "entity" here once #1868004 lands.
if (!empty($this->contextDefinition['type']) && $this->contextDefinition['type'] == 'entity') {
$value = $this
->getTypedContext();
}
else {
$value = $this
->getContextValue();
}
return $validator
->validateValue($value, $this
->getConstraints());
}