/** * Get twig properties for page. * * @param \Page $page * @return array */ public function twigGetPage(\Page $page) { $p = $page->toTwig(); $p['parent'] = new OnDemand(array($this, 'twigGetParent'), $page); $p['subpages'] = new OnDemand(array($this, 'twigGetSubpages'), $page); $activePage = $this->app->page; $p['IsActive'] = $activePage->getUrl() === $page->getUrl(); $p['IsActiveSubpage'] = new OnDemand(array($this, 'twigGetActiveSubpage'), $page, $activePage); return $p; }