{% set breadcrumb = { '_route_user_roles_index': 'News', '_route_user_roles_edit' : {'name' : 'Top News','params': {'id': role.id } } } %}
Basic breadcrump for twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% if breadcrumb is defined %} | |
<ol class="breadcrumb"> | |
<li><a href="{{ path('home_page_route') }}"><i class="fa fa-dashboard"></i>Home Page</a></li> | |
{% for route, name in breadcrumb %} | |
{% set params = {} %} | |
{% if name is iterable %} | |
{% set params = name.params %} | |
{% set name = name.name %} | |
{% endif %} | |
{% if loop.first %} | |
<li> | |
<i class="divider"></i> | |
<a href="{{ path(route,params) }}">{{ name }}</a> | |
</li> | |
{% elseif loop.last %} | |
<li> | |
<i class="divider"></i> | |
<a href="{{ path(route,params) }}">{{ name }}</a> | |
</li> | |
{% else %} | |
<li> | |
<i class="divider"></i> | |
<a href="{{ path(route,params) }}">{{ name }}</a> | |
</li> | |
{% endif %} | |
{% endfor %} | |
</ol> | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment