public function getCurrentDomain() { if (null === $this->domain && $this->getRequest()) { $domain = new Domain(); $domain->setDomain($this->getRequest()->getHost()); $domain->setPath($this->getRequest()->getBasePath()); $domain->setMaster(true); return $domain; } return $this->domain; }
/** * @param array $options * * @return null|Model\Node * * @throws Exceptions\BundleNotFoundException * @throws \Exception */ public function get($options) { $options['id'] = isset($options['id']) ? $options['id'] : false; $options['level'] = isset($options['level']) ? $options['level'] : false; // $withFolders = (isset($options['folders']) && $options['folders'] == 1) ? true : false; $navigation = false; if (!$navigation && $options['id'] != 'breadcrumb' && ($options['id'] || $options['level'])) { if ($options['id'] + 0 > 0) { $navigation = $this->pageStack->getPage($options['id'] + 0); if (!$navigation) { return null; } } if ($options['level'] > 1) { $currentPage = $this->pageStack->getCurrentPage(); $parents = $currentPage->getParents(); $parents[] = $currentPage; $currentLevel = count($parents) + 1; $page = $this->arrayLevel($parents, $options['level']); if ($page && $page->getId() > 0) { $navigation = $this->pageStack->getPage($page->getId()); } elseif ($options['level'] == $currentLevel + 1) { $navigation = $this->pageStack->getCurrentPage(); } } if ($options['level'] == 1) { $navigation = NodeQuery::create()->findRoot($this->pageStack->getCurrentDomain()->getId()); } } return $navigation; }