You are here

public function AssetMediaFactory::getMediaSource in Media: Acquia DAM 8

Get the media source an asset belongs to.

Parameters

int $assetId: The ID of the asset to get the media source for.

string $bundle: A specific bundle to fetch the media entity from.

Return value

false|\Drupal\media\MediaSourceInterface The media source for the given asset or FALSE.

File

src/Service/AssetMediaFactory.php, line 82

Class

AssetMediaFactory
Class AssetMediaFactory.

Namespace

Drupal\media_acquiadam\Service

Code

public function getMediaSource($assetId, $bundle = NULL) {
  $media = $this
    ->getMediaEntity($assetId, $bundle);
  return $media instanceof MediaInterface ? $media
    ->getSource() : FALSE;
}