public function MediaThumbnailManager::getThumbnail in Media Thumbnails 8
Get the thumbnail 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::getThumbnail()
- MediaThumbnailManager::deleteThumbnail in src/
Plugin/ MediaThumbnailManager.php - Delete a media thumbnail.
File
- src/
Plugin/ MediaThumbnailManager.php, line 181
Class
- MediaThumbnailManager
- Provides the Media thumbnail plugin manager.
Namespace
Drupal\media_thumbnails\PluginCode
public function getThumbnail(MediaInterface $media) {
try {
return $this
->getFileObject($media, 'thumbnail');
} catch (Exception $e) {
return NULL;
}
}