FieldWidgetConstraintValidator.php

Same filename in other branches
  1. 9 core/modules/system/tests/modules/entity_test/src/Plugin/Validation/Constraint/FieldWidgetConstraintValidator.php
  2. 8.9.x core/modules/system/tests/modules/entity_test/src/Plugin/Validation/Constraint/FieldWidgetConstraintValidator.php
  3. 10 core/modules/system/tests/modules/entity_test/src/Plugin/Validation/Constraint/FieldWidgetConstraintValidator.php

Namespace

Drupal\entity_test\Plugin\Validation\Constraint

File

core/modules/system/tests/modules/entity_test/src/Plugin/Validation/Constraint/FieldWidgetConstraintValidator.php

View source
<?php

declare (strict_types=1);
namespace Drupal\entity_test\Plugin\Validation\Constraint;

use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;

/**
 * Validates the FieldWidgetConstraint constraint.
 */
class FieldWidgetConstraintValidator extends ConstraintValidator {
    
    /**
     * {@inheritdoc}
     */
    public function validate($field_item, Constraint $constraint) : void {
        $this->context
            ->addViolation($constraint->message);
    }

}

Classes

Title Deprecated Summary
FieldWidgetConstraintValidator Validates the FieldWidgetConstraint constraint.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.