Commit aeb0b24e authored by kishorekumar Nagarajan's avatar kishorekumar Nagarajan Committed by Janez Urevc
Browse files

Issue #2795671 by N.kishorekumar, slashrsm: Make sure that validation error...

Issue #2795671 by N.kishorekumar, slashrsm: Make sure that validation error message has singular form.
parent cf2795a0
Loading
Loading
Loading
Loading
+2 −3
Changes for src/Plugin/EntityBrowser/WidgetValidation/Cardinality.php: 2 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -28,9 +28,8 @@ class Cardinality extends WidgetValidationBase {
    $count = count($entities);
    $max = $options['cardinality'];
    if ($max !== EntityBrowserElement::CARDINALITY_UNLIMITED && $count > $max) {
      $message = 'You can not select more than %max entities.';
      $parameters = ['%max' => $max];
      $violation = new ConstraintViolation($this->t($message, $parameters), $message, $parameters, $count, '', $count);
      $message = $this->formatPlural($max, 'You can not select more than 1 entity.', 'You can not select more than @count entities.');
      $violation = new ConstraintViolation($message, $message, [], $count, '', $count);
      $violations->add($violation);
    }