symfony - KnpMenuBundle: why using 'route' instead of 'uri' transforms the <a> element to <span>? -
i'm creating bundle knpmenubundle on symfony 2.3.x , doesn't mark current element, so, thought problem has using 'uri' instead of 'route' since i'm on symfony , all, thing is, when use route, element changes from
<li><a href="engineerings">engineerings</a></li>
to:
<li><span>engineerings</span></li>
the <a>
element
public function mainmenu(factoryinterface $factory, array $options) { $factory = new menufactory(); $menu = $factory->createitem('root'); $menu->setchildrenattributes(array('id' => 'tabs', 'class' => 'fl')); $menu->addchild('cooperators', array('uri' => 'companies')); $menu->addchild('customers', array('uri' => 'clients')); $menu->addchild('engineerings', array('uri' => 'engineerings')); $menu->addchild('lines', array('uri' => 'lines')); $menu->addchild('priorities', array('uri' => 'priorities')); $menu->addchild('projects', array('uri' => 'projects')); $menu->addchild('statuses', array('uri' => 'statuses')); $menu->addchild('sites', array('uri' => 'sites')); $menu->addchild('reports', array('uri' => 'reports')); $menu->addchild('roles', array('uri' => 'roles')); $menu->addchild('users', array('uri' => 'users')); return $menu; }
the <span>
element
public function mainmenu(factoryinterface $factory, array $options) { $factory = new menufactory(); $menu = $factory->createitem('root'); $menu->setchildrenattributes(array('id' => 'tabs', 'class' => 'fl')); $menu->addchild('cooperators', array('route' => 'companies')); $menu->addchild('customers', array('route' => 'clients')); $menu->addchild('engineerings', array('route' => 'engineerings')); $menu->addchild('lines', array('route' => 'lines')); $menu->addchild('priorities', array('route' => 'priorities')); $menu->addchild('projects', array('route' => 'projects')); $menu->addchild('statuses', array('route' => 'statuses')); $menu->addchild('sites', array('route' => 'sites')); $menu->addchild('reports', array('route' => 'reports')); $menu->addchild('roles', array('route' => 'roles')); $menu->addchild('users', array('route' => 'users')); return $menu; }
now, why happen? also, how can set current item? can't make display 'current' class.
your problem line:
$factory = new menufactory();
you don't need it. remove it. create new menufactory
it's default settings. experience wired behaviour myself when create own factory
this.
Comments
Post a Comment