public function File::getMetadataAttributes in Drupal 9
Same name and namespace in other branches
- 8 core/modules/media/src/Plugin/media/Source/File.php \Drupal\media\Plugin\media\Source\File::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
1 call to File::getMetadataAttributes()
- Image::getMetadataAttributes in core/
modules/ media/ src/ Plugin/ media/ Source/ Image.php - Gets a list of metadata attributes provided by this plugin.
1 method overrides File::getMetadataAttributes()
- Image::getMetadataAttributes in core/
modules/ media/ src/ Plugin/ media/ Source/ Image.php - Gets a list of metadata attributes provided by this plugin.
File
- core/
modules/ media/ src/ Plugin/ media/ Source/ File.php, line 49
Class
- File
- File entity media source.
Namespace
Drupal\media\Plugin\media\SourceCode
public function getMetadataAttributes() {
return [
static::METADATA_ATTRIBUTE_NAME => $this
->t('Name'),
static::METADATA_ATTRIBUTE_MIME => $this
->t('MIME type'),
static::METADATA_ATTRIBUTE_SIZE => $this
->t('File size'),
];
}