Pull merge.
[yaffs-website] / web / core / lib / Drupal / Core / Validation / Plugin / Validation / Constraint / LengthConstraint.php
1 <?php
2
3 namespace Drupal\Core\Validation\Plugin\Validation\Constraint;
4
5 use Symfony\Component\Validator\Constraints\Length;
6
7 /**
8  * Length constraint.
9  *
10  * Overrides the symfony constraint to use Drupal-style replacement patterns.
11  *
12  * @todo: Move this below the TypedData core component.
13  *
14  * @Constraint(
15  *   id = "Length",
16  *   label = @Translation("Length", context = "Validation"),
17  *   type = { "string" }
18  * )
19  */
20 class LengthConstraint extends Length {
21
22   public $maxMessage = 'This value is too long. It should have %limit character or less.|This value is too long. It should have %limit characters or less.';
23   public $minMessage = 'This value is too short. It should have %limit character or more.|This value is too short. It should have %limit characters or more.';
24   public $exactMessage = 'This value should have exactly %limit character.|This value should have exactly %limit characters.';
25
26   /**
27    * {@inheritdoc}
28    */
29   public function validatedBy() {
30     return '\Symfony\Component\Validator\Constraints\LengthValidator';
31   }
32
33 }