public function MediaEntityHelper::getAssetId in Media: Acquia DAM 8
Get the asset ID for the given media entity.
Return value
int|false The asset ID or FALSE on failure.
1 call to MediaEntityHelper::getAssetId()
- MediaEntityHelper::getAsset in src/
MediaEntityHelper.php - Get the asset from a media entity.
File
- src/
MediaEntityHelper.php, line 175
Class
- MediaEntityHelper
- Class MediaEntityHelper.
Namespace
Drupal\media_acquiadamCode
public function getAssetId() {
$sourceField = $this->mediaEntity
->getSource()
->getSourceFieldDefinition($this->mediaEntity
->get('bundle')->entity)
->getName();
return $this
->getFieldPropertyValue($sourceField) ?? FALSE;
}