Skip to content

Instantly share code, notes, and snippets.

@eklect
Last active August 29, 2015 14:15
Show Gist options
  • Save eklect/3aa0160d6a9d001920fd to your computer and use it in GitHub Desktop.
Save eklect/3aa0160d6a9d001920fd to your computer and use it in GitHub Desktop.
How to find all certain type of pages titles in c5
function getAllPagesList($parent,$type) {
$page_list = new PageList();
$page_list->filterByParentID($parent->getCollectionID());
$page_list->sortByName();
$page_list->filterByCollectionTypeHandle($type);
$template_pages = $page_list->get();
$return_data = array();
foreach ($template_pages as $template_page) {
$title = $template_page->getCollectionName();
array_push($return_data,$title);
}
return $return_data;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment