function RecursiveContextualValidator::validate
Same name in other branches
- 9 core/lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php \Drupal\Core\TypedData\Validation\RecursiveContextualValidator::validate()
- 8.9.x core/lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php \Drupal\Core\TypedData\Validation\RecursiveContextualValidator::validate()
- 10 core/lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php \Drupal\Core\TypedData\Validation\RecursiveContextualValidator::validate()
Overrides ContextualValidatorInterface::validate
1 call to RecursiveContextualValidator::validate()
- RecursiveContextualValidator::validatePropertyValue in core/
lib/ Drupal/ Core/ TypedData/ Validation/ RecursiveContextualValidator.php
File
-
core/
lib/ Drupal/ Core/ TypedData/ Validation/ RecursiveContextualValidator.php, line 91
Class
- RecursiveContextualValidator
- Defines a recursive contextual validator for Typed Data.
Namespace
Drupal\Core\TypedData\ValidationCode
public function validate($data, $constraints = NULL, $groups = NULL, $is_root_call = TRUE) : static {
if (isset($groups)) {
throw new \LogicException('Passing custom groups is not supported.');
}
if (!$data instanceof TypedDataInterface) {
throw new \InvalidArgumentException('The passed value must be a typed data object.');
}
// You can pass a single constraint or an array of constraints.
// Make sure to deal with an array in the rest of the code.
if (isset($constraints) && !is_array($constraints)) {
$constraints = [
$constraints,
];
}
$this->validateNode($data, $constraints, $is_root_call);
return $this;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.