protected static function AcquiaDAMStreamWrapper::getAssetById in Media: Acquia DAM 7
Get an asset by ID.
This requires the file already exist in Drupal and has valid JSON saved to the database. We cannot directly look up assets using the API because there is no promise that the user has API access.
Parameters
int $id: The asset ID.
Return value
AcquiaDAM_Assets_Asset|false The asset or FALSE on failure.
1 call to AcquiaDAMStreamWrapper::getAssetById()
- AcquiaDAMStreamWrapper::getAssetByUri in includes/
AcquiaDAMStreamWrapper.inc - Load an asset by the Uri.
File
- includes/
AcquiaDAMStreamWrapper.inc, line 253 - Create an Acquia DAM Stream Wrapper class for the Media/Resource module.
Class
- AcquiaDAMStreamWrapper
- Provides a remote stream wrapper for Acquia DAM assets.
Code
protected static function getAssetById($id) {
module_load_include('inc', 'media_acquiadam', 'includes/media_acquiadam.helpers');
try {
$asset = media_acquiadam_get_asset($id);
} catch (Exception $x) {
watchdog_exception('acquiadam_stream_wrapper', $x);
drupal_set_message(t('@class: Unable to load remote asset: @id.', [
'@class' => __CLASS__,
'@id' => $id,
]), 'warning');
}
return $asset;
}