"Fossies" - the Fresh Open Source Software Archive

Member "drupal-8.9.10/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/CountConstraint.php" (26 Nov 2020, 954 Bytes) of package /linux/www/drupal-8.9.10.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "CountConstraint.php" see the Fossies "Dox" file reference documentation.

    1 <?php
    2 
    3 namespace Drupal\Core\Validation\Plugin\Validation\Constraint;
    4 
    5 use Symfony\Component\Validator\Constraints\Count;
    6 
    7 /**
    8  * Count constraint.
    9  *
   10  * Overrides the symfony constraint to use Drupal-style replacement patterns.
   11  *
   12  * @Constraint(
   13  *   id = "Count",
   14  *   label = @Translation("Count", context = "Validation"),
   15  *   type = { "list" }
   16  * )
   17  */
   18 class CountConstraint extends Count {
   19 
   20   public $minMessage = 'This collection should contain %limit element or more.|This collection should contain %limit elements or more.';
   21   public $maxMessage = 'This collection should contain %limit element or less.|This collection should contain %limit elements or less.';
   22   public $exactMessage = 'This collection should contain exactly %limit element.|This collection should contain exactly %limit elements.';
   23 
   24   /**
   25    * {@inheritdoc}
   26    */
   27   public function validatedBy() {
   28     return '\Symfony\Component\Validator\Constraints\CountValidator';
   29   }
   30 
   31 }