class ValidSequenceKeysConstraint
Checks that all the keys of a sequence match the specified constraints.
Attributes
#[Constraint(id: 'ValidSequenceKeys', label: new TranslatableMarkup('Valid sequence keys', [], [
'context' => 'Validation',
]), type: [
'sequence',
])]
Hierarchy
- class \Drupal\Core\Validation\Plugin\Validation\Constraint\ValidSequenceKeysConstraint implements \Drupal\Core\Plugin\ContainerFactoryPluginInterface extends \Symfony\Component\Validator\Constraints\Existence
Expanded class hierarchy of ValidSequenceKeysConstraint
1 file declares its use of ValidSequenceKeysConstraint
- ValidSequenceKeysValidatorTest.php in core/
tests/ Drupal/ KernelTests/ Core/ Validation/ ValidSequenceKeysValidatorTest.php
File
-
core/
lib/ Drupal/ Core/ Validation/ Plugin/ Validation/ Constraint/ ValidSequenceKeysConstraint.php, line 17
Namespace
Drupal\Core\Validation\Plugin\Validation\ConstraintView source
class ValidSequenceKeysConstraint extends Existence implements ContainerFactoryPluginInterface {
/**
* The error message if a sequence key is invalid.
*
* @var string
*/
public string $message = 'The keys of the sequence do not match the given constraints.';
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) : static {
$constraint_manager = $container->get('validation.constraint');
$constraints = $configuration['constraints'];
$constraint_instances = [];
foreach ($constraints as $constraint_name => $constraint_options) {
$constraint_instances[] = $constraint_manager->create($constraint_name, $constraint_options);
}
return new static($constraint_instances, [
SymfonyConstraint::DEFAULT_GROUP,
]);
}
}
Members
| Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
|---|---|---|---|---|
| ValidSequenceKeysConstraint::$message | public | property | The error message if a sequence key is invalid. | |
| ValidSequenceKeysConstraint::create | public static | function | Creates an instance of the plugin. | Overrides ContainerFactoryPluginInterface::create |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.