Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. MediaSourceBase.php

function MediaSourceBase::getMetadata

Overrides MediaSourceInterface::getMetadata

4 calls to MediaSourceBase::getMetadata()
File::getMetadata in core/modules/media/src/Plugin/media/Source/File.php
Gets the value for a metadata attribute for a given media item.
File::getMetadata in core/modules/media/src/Plugin/media/Source/File.php
Gets the value for a metadata attribute for a given media item.
OEmbed::getMetadata in core/modules/media/src/Plugin/media/Source/OEmbed.php
Gets the value for a metadata attribute for a given media item.
OEmbed::getMetadata in core/modules/media/src/Plugin/media/Source/OEmbed.php
Gets the value for a metadata attribute for a given media item.
2 methods override MediaSourceBase::getMetadata()
File::getMetadata in core/modules/media/src/Plugin/media/Source/File.php
Gets the value for a metadata attribute for a given media item.
OEmbed::getMetadata in core/modules/media/src/Plugin/media/Source/OEmbed.php
Gets the value for a metadata attribute for a given media item.

File

core/modules/media/src/MediaSourceBase.php, line 131

Class

MediaSourceBase
Base implementation of media source plugin.

Namespace

Drupal\media

Code

public function getMetadata(MediaInterface $media, $attribute_name) {
    switch ($attribute_name) {
        case 'default_name':
            return 'media:' . $media->bundle() . ':' . $media->uuid();
        case 'thumbnail_uri':
            $default_thumbnail_filename = $this->pluginDefinition['default_thumbnail_filename'];
            return $this->configFactory
                ->get('media.settings')
                ->get('icon_base_uri') . '/' . $default_thumbnail_filename;
    }
    return NULL;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal