function IgnoreActiveTrailConstraintValidator::validate
File
-
core/
modules/ system/ src/ Plugin/ Validation/ Constraint/ IgnoreActiveTrailConstraintValidator.php, line 19
Class
- IgnoreActiveTrailConstraintValidator
- Validator for the IgnoreActiveTrail constraint.
Namespace
Drupal\system\Plugin\Validation\ConstraintCode
public function validate(mixed $value, Constraint $constraint) : void {
assert($constraint instanceof IgnoreActiveTrailConstraint);
if (!is_array($value)) {
throw new UnexpectedTypeException($value, 'array');
}
if (!empty($value['ignore_active_trail']) && (isset($value['level']) && $value['level'] > 1 || empty($value['expand_all_items']) && $value['depth'] != 1)) {
$this->context
->addViolation($constraint->message);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.