function MediaSourceInterface::getMetadataAttributes
Same name in other branches
- 8.9.x core/modules/media/src/MediaSourceInterface.php \Drupal\media\MediaSourceInterface::getMetadataAttributes()
- 10 core/modules/media/src/MediaSourceInterface.php \Drupal\media\MediaSourceInterface::getMetadataAttributes()
- 11.x core/modules/media/src/MediaSourceInterface.php \Drupal\media\MediaSourceInterface::getMetadataAttributes()
Gets a list of metadata attributes provided by this plugin.
Most media sources have associated metadata, describing attributes such as:
- dimensions
- duration
- encoding
- date
- location
- permalink
- licensing information
- ...
This method should list all metadata attributes that a media source MAY offer. In other words: it is possible that a particular media item does not contain a certain attribute. For example: an oEmbed media source can contain both video and images. Images don't have a duration, but videos do.
(The term 'attributes' was chosen because it cannot be confused with 'fields' and 'properties', both of which are concepts in Drupal's Entity Field API.)
Return value
array Associative array with:
- keys: metadata attribute names
- values: human-readable labels for those attribute names
3 methods override MediaSourceInterface::getMetadataAttributes()
- File::getMetadataAttributes in core/
modules/ media/ src/ Plugin/ media/ Source/ File.php - Gets a list of metadata attributes provided by this plugin.
- OEmbed::getMetadataAttributes in core/
modules/ media/ src/ Plugin/ media/ Source/ OEmbed.php - Gets a list of metadata attributes provided by this plugin.
- Test::getMetadataAttributes in core/
modules/ media/ tests/ modules/ media_test_source/ src/ Plugin/ media/ Source/ Test.php - Gets a list of metadata attributes provided by this plugin.
File
-
core/
modules/ media/ src/ MediaSourceInterface.php, line 106
Class
- MediaSourceInterface
- Defines the interface for media source plugins.
Namespace
Drupal\mediaCode
public function getMetadataAttributes();
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.