bundle/Controller/MenuController.php
public function renderMenu(Request $request, string $menuName): Response
    {
        $menu = $this->menuProvider->get($menuName);
        $menu->setChildrenAttribute('class', $request->attributes->get('ulClass') ?: 'nav navbar-nav');

        $menuOptions = [
            'firstClass' => $request->attributes->get('firstClass') ?: 'firstli',
            'currentClass' => $request->attributes->get('currentClass') ?: 'active',
            'lastClass' => $request->attributes->get('lastClass') ?: 'lastli',
            'template' => $this->getConfigResolver()->getParameter('template.menu', 'ngsite'),
        ];

        if ($request->attributes->has('template')) {
            $menuOptions['template'] = $request->attributes->get('template');
        }

        $response = new Response();

        $menuLocationId = $menu->getAttribute('location-id');
        if (!empty($menuLocationId)) {
            $this->tagHandler->addTags(['location-' . $menuLocationId]);
        }

        $this->processCacheSettings($request, $response);

        $response->setContent($this->menuRenderer->get()->render($menu, $menuOptions));

        return $response;
    }
public function renderMenu(Request $request, string $menuName): Response
    {
        $menu = $this->menuProvider->get($menuName);
        $menu->setChildrenAttribute('class', $request->attributes->get('ulClass') ?: 'nav navbar-nav');

        $menuOptions = [
            'firstClass' => $request->attributes->get('firstClass') ?: 'firstli',
            'currentClass' => $request->attributes->get('currentClass') ?: 'active',
            'lastClass' => $request->attributes->get('lastClass') ?: 'lastli',
            'template' => $this->getConfigResolver()->getParameter('template.menu', 'ngsite'),
        ];

        if ($request->attributes->has('template')) {
            $menuOptions['template'] = $request->attributes->get('template');
        }

        $response = new Response();

        $menuLocationId = $menu->getAttribute('location-id');
        if (!empty($menuLocationId)) {
            $this->tagHandler->addTags(['location-' . $menuLocationId]);
        }

        $this->processCacheSettings($request, $response);

        $response->setContent($this->menuRenderer->get()->render($menu, $menuOptions));

        return $response;
    }
public function renderMenu ( Request $ request , string $ menuName ) : Response { $ menu = $ this -> menuProvider -> get ( $ menuName ) ; $ menu -> setChildrenAttribute ( 'class' , $ request -> attributes -> get ( 'ulClass' ) ? : 'nav navbar-nav' ) ; $ menuOptions = [ 'firstClass' => $ request -> attributes -> get ( 'firstClass' ) ? : 'firstli' , 'currentClass' => $ request -> attributes -> get ( 'currentClass' ) ? : 'active' , 'lastClass' => $ request -> attributes -> get ( 'lastClass' ) ? : 'lastli' , 'template' => $ this -> getConfigResolver ( ) -> getParameter ( 'template.menu' , 'ngsite' ) , ] ; if ( $ request -> attributes -> has ( 'template' ) ) { $ menuOptions [ 'template' ] = $ request -> attributes -> get ( 'template' ) ; } $ response = new Response ( ) ; $ menuLocationId = $ menu -> getAttribute ( 'location-id' ) ; if ( ! empty ( $ menuLocationId ) ) { $ this -> tagHandler -> addTags ( [ 'location-' . $ menuLocationId ] ) ; } $ this -> processCacheSettings ( $ request , $ response ) ; $ response -> setContent ( $ this -> menuRenderer -> get ( ) -> render ( $ menu , $ menuOptions ) ) ; return $ response ; }
Renders the menu with provided name.
Renders the menu with provided name .