Skip to content
Snippets Groups Projects
Commit b58c7950 authored by howard ge's avatar howard ge Committed by howard ge
Browse files

Issue #3382098 by g089h515r806: Add support for Symfony Choice Constraint

parent f0722441
No related branches found
No related tags found
No related merge requests found
<?php
namespace Drupal\field_validation\Plugin\Validation\Constraint;
use Symfony\Component\Validator\Constraints\Choice;
use Symfony\Component\Validator\Constraints\ChoiceValidator;
/**
* Choice constraint.
*
* @Constraint(
* id = "Choice",
* label = @Translation("Choice", context = "Validation"),
* )
*/
class ChoiceConstraint extends Choice {
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.';
/**
* {@inheritdoc}
*/
public function validatedBy(): string {
return ChoiceValidator::class;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment