/** * Retrieves the sub menu array based on the current url * * @param string $menuName * @param int $level * @return array|bool */ public function getSubMenu($menuName, $level = 1) { $currentParent = false; $mainMenuIterator = $this->getFullMenu($menuName); if (!$mainMenuIterator) { return false; } foreach ($mainMenuIterator as $menuItem) { if ($this->currentPath === $menuItem->getPath() || $this->currentPath === $menuItem->getInternalUrl()) { $currentParent = $menuItem->getParentByLevel($level); } } if (!$currentParent) { return false; } $menuIterator = $this->menuManager->getChildrenByStatus($currentParent, false, null, 'ASC', false, $this->viewStatus); return $menuIterator; }