Pimcore\View\Helper\PimcoreNavigationController::buildNextLevel PHP Метод

buildNextLevel() защищенный Метод

protected buildNextLevel ( $parentDocument, boolean $isRoot = false, callable $pageCallback = null ) : array
$parentDocument
$isRoot boolean
$pageCallback callable
Результат array
    protected function buildNextLevel($parentDocument, $isRoot = false, $pageCallback = null)
    {
        $pages = [];
        $childs = $this->getChilds($parentDocument);
        if (is_array($childs)) {
            foreach ($childs as $child) {
                $classes = "";
                if ($child instanceof Document\Hardlink) {
                    $child = Document\Hardlink\Service::wrap($child);
                }
                if (($child instanceof Document\Page or $child instanceof Document\Link) and $child->getProperty("navigation_name")) {
                    $path = $child->getFullPath();
                    if ($child instanceof Document\Link) {
                        $path = $child->getHref();
                    }
                    $page = new $this->_pageClass();
                    $page->setUri($path . $child->getProperty("navigation_parameters") . $child->getProperty("navigation_anchor"));
                    $page->setLabel($child->getProperty("navigation_name"));
                    $page->setActive(false);
                    $page->setId($this->_htmlMenuIdPrefix . $child->getId());
                    $page->setClass($child->getProperty("navigation_class"));
                    $page->setTarget($child->getProperty("navigation_target"));
                    $page->setTitle($child->getProperty("navigation_title"));
                    $page->setAccesskey($child->getProperty("navigation_accesskey"));
                    $page->setTabindex($child->getProperty("navigation_tabindex"));
                    $page->setRelation($child->getProperty("navigation_relation"));
                    $page->setDocument($child);
                    if ($child->getProperty("navigation_exclude") || !$child->getPublished()) {
                        $page->setVisible(false);
                    }
                    if ($isRoot) {
                        $classes .= " main";
                    }
                    $page->setClass($page->getClass() . $classes);
                    if ($child->hasChilds()) {
                        $childPages = $this->buildNextLevel($child, false, $pageCallback);
                        $page->setPages($childPages);
                    }
                    if ($pageCallback instanceof \Closure) {
                        $pageCallback($page, $child);
                    }
                    $pages[] = $page;
                }
            }
        }
        return $pages;
    }