function OEmbed::getMetadataAttributes
Same name and namespace in other branches
- 8.9.x core/modules/media/src/Plugin/media/Source/OEmbed.php \Drupal\media\Plugin\media\Source\OEmbed::getMetadataAttributes()
- 10 core/modules/media/src/Plugin/media/Source/OEmbed.php \Drupal\media\Plugin\media\Source\OEmbed::getMetadataAttributes()
- 11.x core/modules/media/src/Plugin/media/Source/OEmbed.php \Drupal\media\Plugin\media\Source\OEmbed::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
Overrides MediaSourceInterface::getMetadataAttributes
File
-
core/
modules/ media/ src/ Plugin/ media/ Source/ OEmbed.php, line 214
Class
- OEmbed
- Provides a media source plugin for oEmbed resources.
Namespace
Drupal\media\Plugin\media\SourceCode
public function getMetadataAttributes() {
return [
'type' => $this->t('Resource type'),
'title' => $this->t('Resource title'),
'author_name' => $this->t('Author/owner name'),
'author_url' => $this->t('Author/owner URL'),
'provider_name' => $this->t('Provider name'),
'provider_url' => $this->t('Provider URL'),
'cache_age' => $this->t('Suggested cache lifetime'),
'default_name' => $this->t('Media item default name'),
'thumbnail_uri' => $this->t('Thumbnail local URI'),
'thumbnail_width' => $this->t('Thumbnail width'),
'thumbnail_height' => $this->t('Thumbnail height'),
'url' => $this->t('Resource source URL'),
'width' => $this->t('Resource width'),
'height' => $this->t('Resource height'),
'html' => $this->t('Resource HTML representation'),
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.