function RestTestConstraintValidator::validate
Same name in other branches
- 9 core/modules/rest/tests/modules/rest_test/src/Plugin/Validation/Constraint/RestTestConstraintValidator.php \Drupal\rest_test\Plugin\Validation\Constraint\RestTestConstraintValidator::validate()
- 8.9.x core/modules/rest/tests/modules/rest_test/src/Plugin/Validation/Constraint/RestTestConstraintValidator.php \Drupal\rest_test\Plugin\Validation\Constraint\RestTestConstraintValidator::validate()
- 10 core/modules/rest/tests/modules/rest_test/src/Plugin/Validation/Constraint/RestTestConstraintValidator.php \Drupal\rest_test\Plugin\Validation\Constraint\RestTestConstraintValidator::validate()
File
-
core/
modules/ rest/ tests/ modules/ rest_test/ src/ Plugin/ Validation/ Constraint/ RestTestConstraintValidator.php, line 17
Class
- RestTestConstraintValidator
- Validator for \Drupal\rest_test\Plugin\Validation\Constraint\RestTestConstraint.
Namespace
Drupal\rest_test\Plugin\Validation\ConstraintCode
public function validate($value, Constraint $constraint) : void {
if ($value instanceof FieldItemListInterface) {
$value = $value->getValue();
if (!empty($value[0]['value']) && $value[0]['value'] === 'ALWAYS_FAIL') {
$this->context
->addViolation($constraint->message);
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.