Jarves\Navigation::get PHP Method

get() public method

public get ( array $options ) : null | Node
$options array
return null | Jarves\Model\Node
    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;
    }