phiamo/MopaBootstrapBundle — pull request #301 by dafuer (2012-09-23 20:46:09+00:00)
Title: Modified createDropdownMenuItem to support knp element options

Hi,

I find a problem trying to render dropdown menu in navbar without scape. If you want to make an item without scape, you can try something like this (using safe_label) :

$menu->addChild('Vehiculo',array('route' => 'txinbometro_vehiculo', 'label' => 'Vehículo', 'extras'=>array('safe_label'=>true) ));

But if you want to do the same thing in a dropdown, you can't access to knp menu item options. I propose to change createDropdownMenuItem function in AbstractNavbarMenuBuilder to add option parameters. I think if this function wraps a knp menu funciton, it must allow to access to knp options.

I show an example of how to use it before and after the change:

BEFORE:

$estadisticas=$this->createDropdownMenuItem($menu, 'Estadisticas' );
$estadisticas->setLabel('Estadísticas');
$estadisticas->setExtras(array('safe_label'=>true) );

AFTER:

$estadisticas=$this->createDropdownMenuItem($menu, 'Estadisticas', true,array(),array('label'=>'Estadísticas', 'extras'=>array('safe_label'=>true)));

By the way, I improve the PHPDoc in this function.

Sorry for my english.