Version 1
[yaffs-website] / web / modules / contrib / media_entity_slideshow / src / Plugin / Validation / Constraint / ItemsCountConstraint.php
diff --git a/web/modules/contrib/media_entity_slideshow/src/Plugin/Validation/Constraint/ItemsCountConstraint.php b/web/modules/contrib/media_entity_slideshow/src/Plugin/Validation/Constraint/ItemsCountConstraint.php
new file mode 100644 (file)
index 0000000..b01e7d3
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+
+namespace Drupal\media_entity_slideshow\Plugin\Validation\Constraint;
+
+use Symfony\Component\Validator\Constraint;
+
+/**
+ * Check number of slideshow items.
+ *
+ * @Constraint(
+ *   id = "ItemsCount",
+ *   label = @Translation("Slideshow items count", context = "Validation"),
+ * )
+ */
+class ItemsCountConstraint extends Constraint {
+
+  /**
+   * Source field name.
+   *
+   * @var string
+   */
+  public $sourceFieldName;
+
+  /**
+   * The default violation message.
+   *
+   * @var string
+   */
+  public $message = 'At least one slideshow item must exist.';
+
+}