You are here

public function Soundcloud::getMetadataAttributes in Media entity Soundcloud 8.2

Same name and namespace in other branches
  1. 3.x src/Plugin/media/Source/Soundcloud.php \Drupal\media_entity_soundcloud\Plugin\media\Source\Soundcloud::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

src/Plugin/media/Source/Soundcloud.php, line 80

Class

Soundcloud
Soundcloud entity media source.

Namespace

Drupal\media_entity_soundcloud\Plugin\media\Source

Code

public function getMetadataAttributes() {
  $attributes = [
    'track_id' => $this
      ->t('The track id - not always available'),
    'playlist_id' => $this
      ->t('The playlist (set) id - not always available'),
    'source_id' => t('Compound of source type (track or playlist) and id so that it is unique among all SoundCloud media'),
    'html' => $this
      ->t('HTML embed code'),
    'thumbnail_uri' => t('URI of the thumbnail'),
  ];
  return $attributes;
}