summaryrefslogtreecommitdiffstats
path: root/core/modules/media/src/MediaSourceFieldConstraintsInterface.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/modules/media/src/MediaSourceFieldConstraintsInterface.php')
-rw-r--r--core/modules/media/src/MediaSourceFieldConstraintsInterface.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/core/modules/media/src/MediaSourceFieldConstraintsInterface.php b/core/modules/media/src/MediaSourceFieldConstraintsInterface.php
new file mode 100644
index 0000000..b6b535f
--- /dev/null
+++ b/core/modules/media/src/MediaSourceFieldConstraintsInterface.php
@@ -0,0 +1,29 @@
+<?php
+
+namespace Drupal\media;
+
+/**
+ * Defines an interface for a media source with source field constraints.
+ *
+ * This allows a media source to optionally add source field validation
+ * constraints for media items. To add constraints at the entity level, a
+ * media source can also implement MediaSourceEntityConstraintsInterface.
+ *
+ * @see \Drupal\media\MediaSourceInterface
+ * @see \Drupal\media\MediaSourceEntityConstraintsInterface
+ * @see \Drupal\media\MediaSourceBase
+ * @see \Drupal\media\Entity\Media
+ */
+interface MediaSourceFieldConstraintsInterface extends MediaSourceInterface {
+
+ /**
+ * Gets media source-specific validation constraints for a source field.
+ *
+ * @return \Symfony\Component\Validator\Constraint[]
+ * An array of validation constraint definitions, keyed by constraint name.
+ * Each constraint definition can be used for instantiating
+ * \Symfony\Component\Validator\Constraint objects.
+ */
+ public function getSourceFieldConstraints();
+
+}