Anyone !? :) Added some comments to my code bellow . On Wed, May 4, 2011 at 5:04 PM, seven seven <sapt...@gmail.com> wrote:
> Hi everyone, > > Let me be short. I have a class MainMenu and I want to override the > *renderLink() > *from MenuItem in *MyCustomMenuItem *class, but something is not working > because I have nothing in my output html but the default output. > > *In MainMenu extends Menu:* > parent::__construct(array('class' => 'menu'), > 'Tock\TockFlatPagesBundle\Menu\MyCustomMenuItem'); > *$this->setCurrentUri($request->getRequestUri());* * $this->addChild('Home2', $router->generate('_welcome'));* I also tried with : $this->addChild(new MyCustomMenuItem('Home2', $router->generate('_welcome'))); > > *In MyCustomMenuItem extends MenuItem :* > public function renderLink() { > //parent::renderLink(); > > $label = $this->renderLabel(); > $uri = $this->getUri(); > //$this->setAttribute('id', 'back_to_homepage'); > > if (!$uri) { > return $label; > } > // class="level1 active current" > return sprintf('<a href="%s"><span>%s</span>TEST</a>', $uri, > $label); > } > > *In my layout.html.twig:* > {{ menu_get('main').render|raw }} > and I did tried with: > {{ menu('main') }} > but no results. > > Anyone has an idea why this is not working ? > -- > <br> > Cezar > -- <br> Cezar -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en