You are here

class AllowedValuesConstraint in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/AllowedValuesConstraint.php \Drupal\Core\Validation\Plugin\Validation\Constraint\AllowedValuesConstraint
  2. 9 core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/AllowedValuesConstraint.php \Drupal\Core\Validation\Plugin\Validation\Constraint\AllowedValuesConstraint

Checks for the value being allowed.

Plugin annotation


@Constraint(
  id = "AllowedValues",
  label = @Translation("Allowed values", context = "Validation")
)

Hierarchy

  • class \Drupal\Core\Validation\Plugin\Validation\Constraint\AllowedValuesConstraint extends \Symfony\Component\Validator\Constraints\Choice

Expanded class hierarchy of AllowedValuesConstraint

See also

\Drupal\Core\TypedData\OptionsProviderInterface

1 file declares its use of AllowedValuesConstraint
EntityReferenceItem.php in core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php

File

core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/AllowedValuesConstraint.php, line 17

Namespace

Drupal\Core\Validation\Plugin\Validation\Constraint
View source
class AllowedValuesConstraint extends Choice {
  public $strict = TRUE;
  public $minMessage = 'You must select at least %limit choice.|You must select at least %limit choices.';
  public $maxMessage = 'You must select at most %limit choice.|You must select at most %limit choices.';

}

Members