Closed
Description
So I have a menu built as shown in the example below:
public function sidebarMenu(FactoryInterface $factory, array $options)
{
$menu = $factory->createItem('root', array(
'navbar' => true,
'childrenAttributes' => [
'class' => 'nav main-menu',
],
));
$menu->addChild('Dashboard')
->setAttributes([
'icon' =>'fa fa-dashboard',
'class' => 'dropdown',
'dropdown' => true
]);
$menu['Dashboard']->addChild('Details', ['route' => 'app.admin.dashboard.op1']);
$menu['Dashboard']->addChild('Details 2', ['route' => 'app.admin.dashboard.op2']);
$menu->addChild('Users', ['route' => 'app.admin.dashboard.users'])
->setAttribute('icon', 'fa fa-users');
}
How I can create a breadcumb to current rotue if I'm at /dashboard/details?
I want to create a breadcumb which looks like this: home / dashboard / details /
Last month you've added knp_menu_get_breadcrumbs_array
. Should I use this function? Can you share an example with me?
I'm trying to use it in that way:
{% set item = knp_menu_get('AppBundle:AdminMenuBuilder:sidebarMenu') %}
{% set breadcrumbs = knp_menu_get_breadcrumbs_array(item, [ 'Details']) %}
{% for breadcrumb in breadcrumbs %}
{{ dump(breadcrumb) }}
{% endfor %}
Metadata
Metadata
Assignees
Labels
No labels