public function AssetMediaFactory::getAssetIdFields in Media: Acquia DAM 8
Get a list of asset ID fields related to their bundle.
Return value
array An array of media bundles and associated asset ID fields
1 call to AssetMediaFactory::getAssetIdFields()
- AssetMediaFactory::getAssetUsage in src/
Service/ AssetMediaFactory.php - Get a collection of media entities using the given asset ID.
File
- src/
Service/ AssetMediaFactory.php, line 196
Class
- AssetMediaFactory
- Class AssetMediaFactory.
Namespace
Drupal\media_acquiadam\ServiceCode
public function getAssetIdFields() {
// @todo Static caching.
try {
$media_bundles = $this->entityTypeManager
->getStorage('media_type')
->loadByProperties([
'source' => 'acquiadam_asset',
]);
} catch (\Exception $x) {
return [];
}
$asset_id_fields = [];
/** @var \Drupal\media\Entity\MediaType $bundle */
foreach ($media_bundles as $name => $bundle) {
$asset_id_fields[$name] = $bundle
->getSource()
->getSourceFieldDefinition($bundle)
->getName();
}
return $asset_id_fields;
}