EnumConstraint.php
Same filename and directory in other branches
Namespace
Drupal\Core\Validation\Plugin\Validation\ConstraintFile
-
core/
lib/ Drupal/ Core/ Validation/ Plugin/ Validation/ Constraint/ EnumConstraint.php
View source
<?php
declare (strict_types=1);
namespace Drupal\Core\Validation\Plugin\Validation\Constraint;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\Validation\Attribute\Constraint;
use Symfony\Component\Validator\Constraint as SymfonyConstraint;
/**
* Checks that a value is a valid Enum.
*/
class EnumConstraint extends SymfonyConstraint {
/**
* Violation message if the value is not an enum.
*/
public string $notEnumMessage = 'The value you selected is not a valid enum.';
/**
* Violation message if the enum class is missing.
*/
public string $missingClassMessage = 'The Enum data definition must supply an "enum_class".';
/**
* Violation message if the value is not of the expected enum class.
*/
public string $invalidClassMessage = 'The value must be an instance of %class.';
}
Classes
| Title | Deprecated | Summary |
|---|---|---|
| EnumConstraint | Checks that a value is a valid Enum. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.