/** * Get top level NavigationInterface instance * * @return NavigationInterface|null */ public function getNavigation() { if ($this->_parentContainer instanceof NavigationInterface) { return $this->_parentContainer; } elseif ($this->_parentContainer instanceof Item) { return $this->_parentContainer->getNavigation(); } return null; }
/** * {@inheritdoc} */ public function addElement(NavigationInterface $element) { $id = $element->getId(); if (isset($this->elements[$id])) { throw new \LogicException(sprintf('Navigation with ID: "%s" already exists', $id)); } $this->elements[$id] = $element; return $this; }