// get content types related to configuration set $contentTypes = $configSet->getAsset($service)->getSubscribers(); $countCT = count($contentTypes); $totalContentTypes += $countCT; // keep a running total // name of configuration set // Replace '#' with link(/link-fetching code) $ctTxt .= "{\"name\": \"" . $configSet->getPathPath() . "\", \"type\":" . "\"pageconfigurationset\", \"children\":"; $ctTxt .= "["; foreach ($contentTypes as $contentType) { // CONTENT TYPE $pages = $contentType->getAsset($service)->getSubscribers(); $pageCount = count($pages); $totalPages += $pageCount; // Replace '#' with link(/link-fetching code) $ctTxt .= "{\"name\": \"" . StringUtility::getNameFromPath($contentType->getPathPath()) . "\"," . " \"type\": \"contenttype\", \"children\":"; $ctTxt .= "["; if ($pageCount > 0) { foreach ($pages as $page) { // PAGE // Replace '#' with link(/link-fetching code) $ctTxt .= "{\"name\": \"" . $page->getPathPath() . "\", \"url\":" . "\"https://cascade.union.edu:8443/entity/open.act?id=" . $page->getId() . "&type=page\", \"type\": \"page\"},"; } } $ctTxt = rtrim($ctTxt, ","); // Remove last comma, which is invalid. $ctTxt .= "],"; // list of content type pages $ctTxt .= "\"count\": " . $pageCount . "},"; } $ctTxt = rtrim($ctTxt, ",");