You are here

public function Bynder::getMetadataAttributes in Bynder 8.2

Same name and namespace in other branches
  1. 8.3 src/Plugin/media/Source/Bynder.php \Drupal\bynder\Plugin\media\Source\Bynder::getMetadataAttributes()
  2. 4.0.x src/Plugin/media/Source/Bynder.php \Drupal\bynder\Plugin\media\Source\Bynder::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/Bynder.php, line 171

Class

Bynder
Provides media source plugin for Bynder.

Namespace

Drupal\bynder\Plugin\media\Source

Code

public function getMetadataAttributes() {
  $fields = [
    'uuid' => $this
      ->t('ID'),
    'name' => $this
      ->t('Name'),
    'description' => $this
      ->t('Description'),
    'tags' => $this
      ->t('Tags'),
    'type' => $this
      ->t('Type'),
    'video_preview_urls' => $this
      ->t('Video preview urls'),
    'thumbnail_urls' => $this
      ->t('Thumbnail urls'),
    'width' => $this
      ->t('Width'),
    'height' => $this
      ->t('Height'),
    'created' => $this
      ->t('Date created'),
    'modified' => $this
      ->t('Data modified'),
    'propertyOptions' => $this
      ->t('Meta-property option IDs'),
  ];
  return $fields;
}