get(PageService::class); $rootLine = $pageService->getRootLine($pageUid); for (end($rootLine); key($rootLine)!==null; prev($rootLine)){ $page = current($rootLine); if ($page['is_siteroot'] == 1) { return $page; } } return []; } /** * Recursively returns all the subpages of the given page * * @param $pageUid * @return array */ public function getAllSubpagesForPage($pageUid) { $subpages = []; $stack = $this->getSubpagesForPages( [$pageUid], '*', 'sorting', '', false ); foreach ($stack as $page) { $subpages[] = $page; $children = $this->getAllSubpagesForPage($page['uid']); if (!empty($children)) { $subpages = array_merge($subpages, $children); } } return $subpages; } /** * Returns the current site template's name * @param $pageUid * @return string */ public function getCurrentTemplate($pageUid) { $rootPageUid = $this->getRootPageFor($pageUid)['uid']; if (!($rootPageUid >= 0)) { return ''; } $rootPage = $this->getPage($rootPageUid); $templateName = $rootPage['tx_opentalent_template']; if ($templateName==='') { return 'Classic'; } return $templateName; } }