Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / datetime / src / Plugin / Validation / Constraint / DateTimeFormatConstraint.php
1 <?php
2
3 namespace Drupal\datetime\Plugin\Validation\Constraint;
4
5 use Symfony\Component\Validator\Constraint;
6
7 /**
8  * Validation constraint for DateTime items to ensure the format is correct.
9  *
10  * @Constraint(
11  *   id = "DateTimeFormat",
12  *   label = @Translation("Datetime format valid for datetime type.", context = "Validation"),
13  * )
14  */
15 class DateTimeFormatConstraint extends Constraint {
16
17   /**
18    * Message for when the value isn't a string.
19    *
20    * @var string
21    */
22   public $badType = "The datetime value must be a string.";
23
24   /**
25    * Message for when the value isn't in the proper format.
26    *
27    * @var string
28    */
29   public $badFormat = "The datetime value '@value' is invalid for the format '@format'";
30
31   /**
32    * Message for when the value did not parse properly.
33    *
34    * @var string
35    */
36   public $badValue = "The datetime value '@value' did not parse properly for the format '@format'";
37
38 }