You are here

public function FieldWidgetConstraintValidator::validate in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/system/tests/modules/entity_test/src/Plugin/Validation/Constraint/FieldWidgetConstraintValidator.php \Drupal\entity_test\Plugin\Validation\Constraint\FieldWidgetConstraintValidator::validate()

Checks if the passed value is valid.

Parameters

mixed $value The value that should be validated:

Constraint $constraint The constraint for the validation:

Overrides ConstraintValidatorInterface::validate

File

core/modules/system/tests/modules/entity_test/src/Plugin/Validation/Constraint/FieldWidgetConstraintValidator.php, line 20
Contains \Drupal\entity_test\Plugin\Validation\Constraint\FieldWidgetConstraintValidator.

Class

FieldWidgetConstraintValidator
Validates the FieldWidgetConstraint constraint.

Namespace

Drupal\entity_test\Plugin\Validation\Constraint

Code

public function validate($field_item, Constraint $constraint) {
  $this->context
    ->addViolation($constraint->message);
}