summaryrefslogtreecommitdiffstatshomepage
path: root/core/modules/media/src/MediaSourceFieldConstraintsInterface.php
blob: cbbed25834186f2a42365d8bb1908435a8b4da13 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?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 plugin IDs. The
   *   corresponding values are options for each validation plugin.
   *   Each constraint definition can be used for instantiating
   *   \Symfony\Component\Validator\Constraint objects.
   */
  public function getSourceFieldConstraints();

}