X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fcore%2Fmodules%2Fmedia%2Fsrc%2FMediaSourceInterface.php;fp=web%2Fcore%2Fmodules%2Fmedia%2Fsrc%2FMediaSourceInterface.php;h=6d08c2039585e59fe62ebaa0015a0b6cebf9f96a;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hp=723e0b9a8e05276f217fbcebc976049be508a41a;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0;p=yaffs-website diff --git a/web/core/modules/media/src/MediaSourceInterface.php b/web/core/modules/media/src/MediaSourceInterface.php index 723e0b9a8..6d08c2039 100644 --- a/web/core/modules/media/src/MediaSourceInterface.php +++ b/web/core/modules/media/src/MediaSourceInterface.php @@ -4,6 +4,8 @@ namespace Drupal\media; use Drupal\Component\Plugin\ConfigurablePluginInterface; use Drupal\Component\Plugin\PluginInspectionInterface; +use Drupal\Core\Entity\Display\EntityFormDisplayInterface; +use Drupal\Core\Entity\Display\EntityViewDisplayInterface; use Drupal\Core\Plugin\PluginFormInterface; /** @@ -23,7 +25,7 @@ use Drupal\Core\Plugin\PluginFormInterface; * - Image: handles local images, * - oEmbed: handles resources that are exposed through the oEmbed standard, * - YouTube: handles YouTube videos, - * - SoundCould: handles SoundCloud audio, + * - SoundCloud: handles SoundCloud audio, * - Instagram: handles Instagram posts, * - Twitter: handles tweets, * - ... @@ -139,4 +141,54 @@ interface MediaSourceInterface extends PluginInspectionInterface, ConfigurablePl */ public function createSourceField(MediaTypeInterface $type); + /** + * Prepares the media type fields for this source in the view display. + * + * This method should normally call + * \Drupal\Core\Entity\Display\EntityDisplayInterface::setComponent() or + * \Drupal\Core\Entity\Display\EntityDisplayInterface::removeComponent() to + * configure the media type fields in the view display. + * + * @param \Drupal\media\MediaTypeInterface $type + * The media type which is using this source. + * @param \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display + * The display which should be prepared. + * + * @see \Drupal\Core\Entity\Display\EntityDisplayInterface::setComponent() + * @see \Drupal\Core\Entity\Display\EntityDisplayInterface::removeComponent() + */ + public function prepareViewDisplay(MediaTypeInterface $type, EntityViewDisplayInterface $display); + + /** + * Prepares the media type fields for this source in the form display. + * + * This method should normally call + * \Drupal\Core\Entity\Display\EntityDisplayInterface::setComponent() or + * \Drupal\Core\Entity\Display\EntityDisplayInterface::removeComponent() to + * configure the media type fields in the form display. + * + * @param \Drupal\media\MediaTypeInterface $type + * The media type which is using this source. + * @param \Drupal\Core\Entity\Display\EntityFormDisplayInterface $display + * The display which should be prepared. + * + * @see \Drupal\Core\Entity\Display\EntityDisplayInterface::setComponent() + * @see \Drupal\Core\Entity\Display\EntityDisplayInterface::removeComponent() + */ + public function prepareFormDisplay(MediaTypeInterface $type, EntityFormDisplayInterface $display); + + /** + * Get the primary value stored in the source field. + * + * @param MediaInterface $media + * A media item. + * + * @return mixed + * The source value. + * + * @throws \RuntimeException + * If the source field for the media source is not defined. + */ + public function getSourceFieldValue(MediaInterface $media); + }