public function AcquiaDAM_Assets_Folder::getAssets in Media: Acquia DAM 7
Get assets located in the folder.
Parameters
array $options: Options to pass to the API request.
bool $fullyLoad: TRUE to fully load returned assets.
Return value
array An array containing child folders and asset items.
File
- src/
AcquiaDAM/ AcquiaDAM_Assets_Folder.inc, line 71
Class
- AcquiaDAM_Assets_Folder
- Acquia DAM asset implmentation for Folder assets.
Code
public function getAssets(array $options = [], $fullyLoad = FALSE) {
$this
->requireId();
$options += [
'sortby' => 'filename',
'sortdir' => 'desc',
'limit' => 50,
'offset' => 0,
];
$result = $this
->request(sprintf('folders/%d/assets', $this->asset['id']), $options);
$mapping = [
'items' => 'asset',
'folders' => 'folder',
];
foreach ($mapping as $key => $type) {
if (!empty($result[$key]) && is_array($result[$key])) {
$result[$key] = array_map(function ($item) use ($type, $fullyLoad) {
$id = $fullyLoad ? $item['id'] : $item;
return media_acquiadam_get_helper($type, $id, $this->depends);
}, $result[$key]);
}
}
return $result;
}