diff --git a/core/modules/media/src/MediaHandlerInterface.php b/core/modules/media/src/MediaHandlerInterface.php index 31dc02c6c8..4afafce5c9 100644 --- a/core/modules/media/src/MediaHandlerInterface.php +++ b/core/modules/media/src/MediaHandlerInterface.php @@ -9,9 +9,26 @@ /** * Defines the interface for media handler plugins. * + * Media handlers are the essential part of the media entity type as they + * implement the knowledge and business logic related to a given sort of media. + * Media entity doesn't have any knowledge anything about media it represents + * without handlers. + * + * Each Media type needs exactly one handler and a single handler can be used on + * many media types. + * + * Their main responsibilities are: + * - defining how media is represented (stored), + * - providing thumbnails, + * - validating media before it is saved, + * - providing default value for the media name field, + * - providing metadata specific to the given media, + * - handling mapping between metadata and entity fields. + * * @see \Drupal\media\Annotation\MediaHandler * @see \Drupal\media\MediaHandlerBase * @see \Drupal\media\MediaHandlerManager + * @see \Drupal\media\MediaTypeInterface * @see plugin_api */ interface MediaHandlerInterface extends PluginInspectionInterface, ConfigurablePluginInterface, PluginFormInterface { diff --git a/core/modules/media/src/MediaTypeInterface.php b/core/modules/media/src/MediaTypeInterface.php index 72429d38c7..311d0f4e70 100644 --- a/core/modules/media/src/MediaTypeInterface.php +++ b/core/modules/media/src/MediaTypeInterface.php @@ -8,6 +8,17 @@ /** * Provides an interface defining a media type entity. + * + * Media types are bundles for the media entity. They are used to group media + * with same semantics. Media types are not about where media comes from. They + * are about the meaning that media has in context of a given Drupal site. + * + * Media handlers, on the other hand, are aware where media comes from and know + * how to represent and handle it in Drupal's context. They are aware of the low + * level details, while types don't care about them at all. That said, media + * types can not exist without handlers. + * + * @see \Drupal\media\MediaHandlerInterface */ interface MediaTypeInterface extends ConfigEntityInterface, EntityDescriptionInterface, RevisionableEntityBundleInterface {