, Heimspiel GmbH * @package Vhs * @subpackage ViewHelpers\Page */ class RootlineViewHelper extends AbstractViewHelper { use TemplateVariableViewHelperTrait; /** * @var PageSelectService */ protected $pageSelect; /** * @param PageSelectService $pageSelectService * @return void */ public function injectPageSelectService(PageSelectService $pageSelectService) { $this->pageSelect = $pageSelectService; } /** * Initialize arguments. * * @return void * @api */ public function initializeArguments() { parent::initializeArguments(); $this->registerAsArgument(); $this->registerArgument('pageUid', 'integer', 'Optional page uid to use.', FALSE, 0); } /** * @return mixed */ public function render() { $pageUid = $this->arguments['pageUid']; if (0 === $pageUid) { $pageUid = $GLOBALS['TSFE']->id; } $rootLineData = $this->pageSelect->getRootLine($pageUid); return $this->renderChildrenWithVariableOrReturnInput($rootLineData); } }