Skip to content

Instantly share code, notes, and snippets.

@derhansen
Created October 15, 2017 10:04
Show Gist options
  • Save derhansen/ff8f7094f8124a3fa94648b5e93bbf1f to your computer and use it in GitHub Desktop.
Save derhansen/ff8f7094f8124a3fa94648b5e93bbf1f to your computer and use it in GitHub Desktop.
protected function getRootPage($uid)
{
/** @var PageRepository $pageRepository */
$pageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(PageRepository::class);
$rootLinePages = $pageRepository->getRootLine($uid);
$rootPage = null;
foreach ($rootLinePages as $page) {
if ($page['is_siteroot'] === '1') {
$rootPage = $page;
break;
}
}
return $rootPage;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment