You are here

public function MediaThumbnailManager::isLocal in Media Thumbnails 8

Check if the media source is a local file.

Parameters

\Drupal\media\MediaInterface $media: The media entity.

Return value

bool TRUE if there is a local file, FALSE otherwise.

1 call to MediaThumbnailManager::isLocal()
MediaThumbnailManager::getPluginId in src/Plugin/MediaThumbnailManager.php
Get the thumbnail plugin id for a media entity, if any.

File

src/Plugin/MediaThumbnailManager.php, line 224

Class

MediaThumbnailManager
Provides the Media thumbnail plugin manager.

Namespace

Drupal\media_thumbnails\Plugin

Code

public function isLocal(MediaInterface $media) : bool {
  $source = $media
    ->getSource()
    ->getConfiguration()['source_field'];
  return $media
    ->get($source) instanceof FileFieldItemList;
}