public function AcquiaDAMStreamWrapper::getExternalUrl in Media: Acquia DAM 7
Return the external Url.
Overrides DrupalRemoteStreamWrapper::getExternalUrl
File
- includes/
AcquiaDAMStreamWrapper.inc, line 188 - Create an Acquia DAM Stream Wrapper class for the Media/Resource module.
Class
- AcquiaDAMStreamWrapper
- Provides a remote stream wrapper for Acquia DAM assets.
Code
public function getExternalUrl() {
if ('acquiadam' !== file_uri_scheme($this->uri)) {
return $this->uri;
}
$asset = static::getAssetByUri($this->uri);
if (empty($asset)) {
return FALSE;
}
$preview = $asset
->getPreviewUrl();
if (empty($preview)) {
// All other files (txt, docx, html, etc.).
return url('acquiadam/asset/' . $asset['id'], [
'absolute' => TRUE,
]);
}
return $preview;
}