public function renderMenu($slug, $view = 'VinceCmsBundle:Component:menu.html.twig', array $parameters = array())
    {
        /** @var Menu $menu */
        $menu = $this->repositories['menu']->findOneBy(array('slug' => $slug, 'lvl' => 0));
        if (!$menu || !$menu->getChildren()->count() || (!$menu->isPublished() && !$this->security->isGranted('ROLE_ADMIN'))) {
            return;
        }

        return $this->environment->render($view, array_merge(array('menu' => $menu), $parameters));
    }
public function renderMenu($slug, $view = 'VinceCmsBundle:Component:menu.html.twig', array $parameters = array())
    {
        /** @var Menu $menu */
        $menu = $this->repositories['menu']->findOneBy(array('slug' => $slug, 'lvl' => 0));
        if (!$menu || !$menu->getChildren()->count() || (!$menu->isPublished() && !$this->security->isGranted('ROLE_ADMIN'))) {
            return;
        }

        return $this->environment->render($view, array_merge(array('menu' => $menu), $parameters));
    }
public function renderMenu ( $ slug , $ view = 'VinceCmsBundle:Component:menu.html.twig' , array $ parameters = array ( ) ) { /** @var Menu $menu */ $ menu = $ this -> repositories [ 'menu' ] -> findOneBy ( array ( 'slug' => $ slug , 'lvl' => 0 ) ) ; if ( ! $ menu || ! $ menu -> getChildren ( ) -> count ( ) || ( ! $ menu -> isPublished ( ) && ! $ this -> security -> isGranted ( 'ROLE_ADMIN' ) ) ) { return ; } return $ this -> environment -> render ( $ view , array_merge ( array ( 'menu' => $ menu ) , $ parameters ) ) ; }
Render a Menu

@author Vincent Chalamon <vincentchalamon@gmail.com>

@param string $slug       Menu slug
@param string $view       View path
@param array  $parameters View parameters

@return null|string
Render a Menu