If you are using KnpMenu
> 2.1, you can directly use this feature:
- PR: KnpLabs/KnpMenu#228
- Doc: https://github.com/KnpLabs/KnpMenu/blob/master/doc/02-Twig-Integration.markdown#functions
You can use it like this:
<ol class="breadcrumb">
{% for breadcrumb_item in knp_menu_get_breadcrumbs_array(knp_menu_get_current_item('main')) %}
{% if not loop.last %}
<li><a href="{{ breadcrumb_item.uri }}">{{ breadcrumb_item.label }}</a></li>
{% else %}
<li class="active">{{ breadcrumb_item.label }}</li>
{% endif %}
{% endfor %}
</ol>
A PR on the
KnpMenu
repo is open : KnpLabs/KnpMenu#228