- Issue created by @dan612
- 🇮🇳India rajeshreeputra Pune
Try using
getAsset($asset_id)
method.$asset_data = \Drupal::service('acquia_dam.client.factory')->getSiteClient()->getAsset($asset_id); if ($asset_data) { $asset_url = $asset_data['embeds']['original']; }
- 🇮🇳India rajeshreeputra Pune
You can also try
/** @var \Drupal\acquia_dam\Plugin\media\Source\Asset $source */ $source = $media->getSource(); $embed_codes = $source->getMetadata($media, 'embeds'); $url = $embed_codes['original']['url'];
- 🇺🇸United States dan612 Portland, Maine
Thank you! these are working for me. Much more streamlined 😁.
Would it be worth adding these to the README in a ## DEVELOPER USAGE section?
- 🇮🇳India rajeshreeputra Pune
You can also use a stream wrapper if both asset_id and version_id are available.
\Drupal::service('stream_wrapper.acquia_dam')->getViaUri('acquia-dam://<asset_id>/<version_id>')->getExternalUrl();
- Merge request !1913530888: Add information to readme about retrieving urls from php. → (Open) created by dan612