Version 1
[yaffs-website] / web / modules / contrib / entity_browser / src / WidgetValidationInterface.php
diff --git a/web/modules/contrib/entity_browser/src/WidgetValidationInterface.php b/web/modules/contrib/entity_browser/src/WidgetValidationInterface.php
new file mode 100644 (file)
index 0000000..65ad7ef
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+
+namespace Drupal\entity_browser;
+
+use Drupal\Component\Plugin\ConfigurablePluginInterface;
+use Drupal\Component\Plugin\PluginInspectionInterface;
+
+
+/**
+ * Defines the interface for entity browser widget validations.
+ */
+interface WidgetValidationInterface extends PluginInspectionInterface, ConfigurablePluginInterface {
+
+  /**
+   * Returns the widget validation label.
+   *
+   * @return string
+   *   The widget validation label.
+   */
+  public function label();
+
+  /**
+   * Validates the widget.
+   *
+   * @param array $entities
+   *   Array of selected entities.
+   * @param array $options
+   *   (Optional) Array of options needed by the constraint validator.
+   *
+   * @return \Symfony\Component\Validator\ConstraintViolationListInterface
+   *   A list of constraint violations. If the list is empty, validation
+   *   succeeded.
+   */
+  public function validate(array $entities, $options = []);
+}