public function MediaEntityHelper::getAssetFileField in Media: Acquia DAM 8
Gets the file field being used to store the asset.
Return value
false|string The name of the file field on the media bundle or FALSE on failure.
2 calls to MediaEntityHelper::getAssetFileField()
- MediaEntityHelper::getAssetFileDestination in src/
MediaEntityHelper.php - Gets the destination path for Acquia DAM assets.
- MediaEntityHelper::getExistingFileId in src/
MediaEntityHelper.php - Gets the existing file ID from the given Media entity.
File
- src/
MediaEntityHelper.php, line 143
Class
- MediaEntityHelper
- Class MediaEntityHelper.
Namespace
Drupal\media_acquiadamCode
public function getAssetFileField() {
try {
/** @var \Drupal\media\Entity\MediaType $bundle */
$bundle = $this->entityTypeManager
->getStorage('media_type')
->load($this->mediaEntity
->bundle());
$field_map = !empty($bundle) ? $bundle
->getFieldMap() : FALSE;
} catch (\Exception $x) {
return FALSE;
}
return empty($field_map['file']) ? FALSE : $field_map['file'];
}