public function MediaThumbnailManager::getSource in Media Thumbnails 8
Get the source file object for a media entity, if any.
Parameters
\Drupal\media\MediaInterface $media: The given media entity.
Return value
\Drupal\Core\Entity\EntityInterface|null The loaded file object.
1 call to MediaThumbnailManager::getSource()
- MediaThumbnailManager::createThumbnail in src/
Plugin/ MediaThumbnailManager.php - Create a new media thumbnail.
File
- src/
Plugin/ MediaThumbnailManager.php, line 162
Class
- MediaThumbnailManager
- Provides the Media thumbnail plugin manager.
Namespace
Drupal\media_thumbnails\PluginCode
public function getSource(MediaInterface $media) {
try {
return $this
->getFileObject($media, $media
->getSource()
->getConfiguration()['source_field']);
} catch (Exception $e) {
return NULL;
}
}