src/Sulu/Bundle/AdminBundle/Admin/NavigationRegistry.php
private function processNavigationItem(NavigationItem $navigationItem): void
    {
        // create label from name when no label is set
        if (!$navigationItem->getLabel()) {
            $navigationItem->setLabel($this->translator->trans($navigationItem->getName(), [], 'admin'));
        }

        // add child routes
        if ($navigationItem->getMainRoute()) {
            $mainPath = $this->routeRegistry->findRouteByName($navigationItem->getMainRoute())->getPath();
            foreach ($this->routeRegistry->getRoutes() as $route) {
                if (false !== strpos($route->getPath(), $mainPath)) {
                    $navigationItem->addChildRoute($route->getName());
                }
            }
        }

        // process all children
        foreach ($navigationItem->getChildren() as $child) {
            $this->processNavigationItem($child);
        }
    }
private function processNavigationItem(NavigationItem $navigationItem): void
    {
        // create label from name when no label is set
        if (!$navigationItem->getLabel()) {
            $navigationItem->setLabel($this->translator->trans($navigationItem->getName(), [], 'admin'));
        }

        // add child routes
        if ($navigationItem->getMainRoute()) {
            $mainPath = $this->routeRegistry->findRouteByName($navigationItem->getMainRoute())->getPath();
            foreach ($this->routeRegistry->getRoutes() as $route) {
                if (false !== strpos($route->getPath(), $mainPath)) {
                    $navigationItem->addChildRoute($route->getName());
                }
            }
        }

        // process all children
        foreach ($navigationItem->getChildren() as $child) {
            $this->processNavigationItem($child);
        }
    }
private function processNavigationItem ( NavigationItem $ navigationItem ) : void { // create label from name when no label is set if ( ! $ navigationItem -> getLabel ( ) ) { $ navigationItem -> setLabel ( $ this -> translator -> trans ( $ navigationItem -> getName ( ) , [ ] , 'admin' ) ) ; } // add child routes if ( $ navigationItem -> getMainRoute ( ) ) { $ mainPath = $ this -> routeRegistry -> findRouteByName ( $ navigationItem -> getMainRoute ( ) ) -> getPath ( ) ; foreach ( $ this -> routeRegistry -> getRoutes ( ) as $ route ) { if ( false !== strpos ( $ route -> getPath ( ) , $ mainPath ) ) { $ navigationItem -> addChildRoute ( $ route -> getName ( ) ) ; } } } // process all children foreach ( $ navigationItem -> getChildren ( ) as $ child ) { $ this -> processNavigationItem ( $ child ) ; } }
Adds the translation and the child routes to the given navigation item.
Adds the translation and the child routes to the given navigation item .