public function Acquiadam::getFlattenedFolderList in Media: Acquia DAM 8
Get a list of folders keyed by ID.
Parameters
int $folder_id: The folder ID to recurse into. This is mostly for internal use.
Return value
array A list of folder names keyed by folder IDs.
Overrides AcquiadamInterface::getFlattenedFolderList
File
- src/
Acquiadam.php, line 76
Class
- Acquiadam
- Class Acquiadam.
Namespace
Drupal\media_acquiadamCode
public function getFlattenedFolderList($folder_id = NULL) {
$folder_data = [];
if (is_null($folder_id)) {
$folders = $this->acquiaDamClient
->getTopLevelFolders();
}
else {
$folder = $this->acquiaDamClient
->getFolder($folder_id);
$folders = !empty($folder->folders) ? $folder->folders : [];
}
foreach ($folders as $folder) {
$folder_data[$folder->id] = $folder->name;
$folder_list = $this
->getFlattenedFolderList($folder->id);
foreach ($folder_list as $folder_id => $folder_name) {
$folder_data[$folder_id] = $folder_name;
}
}
return $folder_data;
}