src/Menu/MenuBuilder.php
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;
    }
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;
    }
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 ; }
Retrieves the sub menu array based on the current url.

@param string $menuName
@param int $level

@return array|bool
Retrieves the sub menu array based on the current url .