public function AcquiaDAM_Assets_AbstractAsset::__construct in Media: Acquia DAM 7
Create an Asset.
Can load an asset direct from the API when given an ID, or pre-populate the asset if given an array of asset informatino to use.
Parameters
int|array $assetId: The asset ID or an array of asset information.
array $depends: An array of class dependencies.
File
- src/
AcquiaDAM/ AcquiaDAM_Assets_AbstractAsset.inc, line 56
Class
- AcquiaDAM_Assets_AbstractAsset
- Abstract class base for Acquia DAM assets.
Code
public function __construct($assetId = NULL, array $depends = []) {
$this->depends = $depends;
if (is_numeric($assetId)) {
$this
->setId($assetId);
}
elseif (is_array($assetId) && !empty($assetId['id'])) {
$this->asset = $assetId;
$this
->setId($assetId['id'], FALSE);
}
elseif (!empty($assetId)) {
throw new InvalidArgumentException('Constructor was given bad assetId data.');
}
}