Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / media / src / MediaTypeInterface.php
1 <?php
2
3 namespace Drupal\media;
4
5 use Drupal\Core\Config\Entity\ConfigEntityInterface;
6 use Drupal\Core\Entity\EntityDescriptionInterface;
7 use Drupal\Core\Entity\RevisionableEntityBundleInterface;
8
9 /**
10  * Provides an interface defining a media type entity.
11  *
12  * Media types are bundles for media items. They are used to group media with
13  * the same semantics. Media types are not about where media comes from. They
14  * are about the semantics that media has in the context of a given Drupal site.
15  *
16  * Media sources, on the other hand, are aware where media comes from and know
17  * how to represent and handle it in Drupal's context. They are aware of the low
18  * level details, while the media types don't care about them at all. That said,
19  * media types can not exist without media sources.
20  *
21  * Consider the following examples:
22  * - oEmbed media source which can represent any oEmbed resource. Media types
23  *   that could be used with this source are "Videos", "Charts", "Music", etc.
24  *   All of them are retrieved using the same protocol, but they represent very
25  *   different things.
26  * - Media sources that represent files could be used with media types like
27  *   "Invoices", "Subtitles", "Meeting notes", etc. They are all files stored on
28  *   some kind of storage, but their meaning and uses in a Drupal site are
29  *   different.
30  *
31  * @see \Drupal\media\MediaSourceInterface
32  */
33 interface MediaTypeInterface extends ConfigEntityInterface, EntityDescriptionInterface, RevisionableEntityBundleInterface {
34
35   /**
36    * Returns whether thumbnail downloads are queued.
37    *
38    * @return bool
39    *   TRUE if thumbnails are queued for download later, FALSE if they should be
40    *   downloaded now.
41    */
42   public function thumbnailDownloadsAreQueued();
43
44   /**
45    * Sets a flag to indicate that thumbnails should be downloaded via a queue.
46    *
47    * @param bool $queue_thumbnail_downloads
48    *   The queue downloads flag.
49    *
50    * @return $this
51    */
52   public function setQueueThumbnailDownloadsStatus($queue_thumbnail_downloads);
53
54   /**
55    * Returns the media source plugin.
56    *
57    * @return \Drupal\media\MediaSourceInterface
58    *   The media source.
59    */
60   public function getSource();
61
62   /**
63    * Sets whether new revisions should be created by default.
64    *
65    * @param bool $new_revision
66    *   TRUE if media items of this type should create new revisions by default.
67    *
68    * @return $this
69    */
70   public function setNewRevision($new_revision);
71
72   /**
73    * Returns the metadata field map.
74    *
75    * Field mapping allows site builders to map media item-related metadata to
76    * entity fields. This information will be used when saving a given media item
77    * and if metadata values will be available they are going to be automatically
78    * copied to the corresponding entity fields.
79    *
80    * @return array
81    *   Field mapping array provided by media source with metadata attribute
82    *   names as keys and entity field names as values.
83    */
84   public function getFieldMap();
85
86   /**
87    * Sets the metadata field map.
88    *
89    * @param array $map
90    *   Field mapping array with metadata attribute names as keys and entity
91    *   field names as values.
92    *
93    * @return $this
94    */
95   public function setFieldMap(array $map);
96
97 }