public static function getPagesArray($obj = NULL) { if ($obj === NULL) { $obj = Elements::getFromParent(0, false); } $elements = $obj; foreach ($elements as $element) { $pageArray[] = array('name' => $element->getName(), 'id' => $element->getId(), 'children' => Elements::getPagesArray($element->getElements(false))); } if (!is_array($pageArray)) { return "none"; } return $pageArray; }