function ToolbarItemConstraintValidator::validate
Same name in other branches
- 9 core/modules/ckeditor5/src/Plugin/Validation/Constraint/ToolbarItemConstraintValidator.php \Drupal\ckeditor5\Plugin\Validation\Constraint\ToolbarItemConstraintValidator::validate()
- 11.x core/modules/ckeditor5/src/Plugin/Validation/Constraint/ToolbarItemConstraintValidator.php \Drupal\ckeditor5\Plugin\Validation\Constraint\ToolbarItemConstraintValidator::validate()
Throws
\Symfony\Component\Validator\Exception\UnexpectedTypeException Thrown when the given constraint is not supported by this validator.
File
-
core/
modules/ ckeditor5/ src/ Plugin/ Validation/ Constraint/ ToolbarItemConstraintValidator.php, line 27
Class
- ToolbarItemConstraintValidator
- Toolbar item constraint validator.
Namespace
Drupal\ckeditor5\Plugin\Validation\ConstraintCode
public function validate($toolbar_item, Constraint $constraint) {
if (!$constraint instanceof ToolbarItemConstraint) {
throw new UnexpectedTypeException($constraint, __NAMESPACE__ . '\\ToolbarItem');
}
if ($toolbar_item === NULL) {
return;
}
if (!static::isValidToolbarItem($toolbar_item)) {
$this->context
->buildViolation($constraint->message)
->setParameter('%toolbar_item', $toolbar_item)
->setInvalidValue($toolbar_item)
->addViolation();
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.