class AllowedValuesConstraint

Same name in other branches
  1. 9 core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/AllowedValuesConstraint.php \Drupal\Core\Validation\Plugin\Validation\Constraint\AllowedValuesConstraint
  2. 8.9.x core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/AllowedValuesConstraint.php \Drupal\Core\Validation\Plugin\Validation\Constraint\AllowedValuesConstraint
  3. 10 core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/AllowedValuesConstraint.php \Drupal\Core\Validation\Plugin\Validation\Constraint\AllowedValuesConstraint

Checks for the value being allowed.

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 14

Namespace

Drupal\Core\Validation\Plugin\Validation\Constraint
View source
class AllowedValuesConstraint extends Choice {
    
    /**
     * {@inheritdoc}
     */
    public function __construct(...$args) {
        $this->strict = TRUE;
        $this->minMessage = 'You must select at least %limit choice.|You must select at least %limit choices.';
        $this->maxMessage = 'You must select at most %limit choice.|You must select at most %limit choices.';
        parent::__construct(...$args);
    }

}

Members

Title Sort descending Modifiers Object type Summary
AllowedValuesConstraint::__construct public function

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