Core/getFolders
From PunchCMS
PCMS_Client->getFolders([elementApiName], [getFirst])
Overview
Get a list of folders with an optional specific api name from the root folder.
Arguments
elementApiName [string, optional]
API name of the folders you are looking for.
getFirst [boolean, optional]
Indicate if you want to get only the first found folder or a collection of folders. Default is FALSE.
Returns
If folders are found matching the criteria this method returns a valid Elements object. Otherwise an empty collection. That way you can test if you get a valid return using the count() method.
If the getFirst argument was set to TRUE and a folder was found it will return a valid Element object. Otherwise NULL.
Example
$objCms = PCMS_Client::getInstance(); // Get a collection of folders with API name 'Folder'. $objElements = $objCms->getFolders("Folder"); foreach ($objElements as $objElement) { // Loop through the collection of folders. }