3 namespace Drupal\media_entity;
5 use Drupal\Component\Plugin\PluginInspectionInterface;
6 use Drupal\Component\Plugin\ConfigurablePluginInterface;
7 use Drupal\Core\Plugin\PluginFormInterface;
10 * Defines the interface for media types.
12 interface MediaTypeInterface extends PluginInspectionInterface, ConfigurablePluginInterface, PluginFormInterface {
15 * Returns the display label.
20 public function label();
23 * Gets list of fields provided by this plugin.
26 * Associative array with field names as keys and descriptions as values.
28 public function providedFields();
31 * Gets a media-related field/value.
33 * @param MediaInterface $media
36 * Name of field to fetch.
39 * Field value or FALSE if data unavailable.
41 public function getField(MediaInterface $media, $name);
44 * Attaches type-specific constraints to media.
46 * @param MediaInterface $media
49 public function attachConstraints(MediaInterface $media);
52 * Gets thumbnail image.
54 * Media type plugin is responsible for returning URI of the generic thumbnail
55 * if no other is available. This functions should always return a valid URI.
57 * @param MediaInterface $media
61 * URI of the thumbnail.
63 public function thumbnail(MediaInterface $media);
66 * Gets the default thumbnail image.
69 * Uri of the default thumbnail image.
71 public function getDefaultThumbnail();
74 * Provide a default name for the media.
76 * Plugins defining media bundles are suggested to override this method and
77 * provide a default name, to be used when there is no user-defined label
80 * @param \Drupal\media_entity\MediaInterface $media
84 * The string that should be used as default media name.
86 public function getDefaultName(MediaInterface $media);