I want to inject Font Awesome icons to user menu based on the route/link of each item.
But it looks like there is no way to get the path grom the url object. I tried everything I could think of but nothing worked. It's like the url object won't give any data in Twig.
This is what I am trying to do in menu template for user acocunt:
<li{{ item.attributes.addClass(classes) }}>
{% set uri = path(item.url.routeName) %}
<pre>{{ dump(item) }}</pre>
<pre>{{ dump(uri) }}</pre>
{% if uri == 'user' %}
<i class="fa fa-user"></i>
{% elseif uri == 'user/logout' %}
<i class="fa fa-sign-out"></i>
{% elseif uri == 'user/register' %}
<i class="fa fa-user-plus"></i>
{% elseif uri == 'user/login' %}
<i class="fa fa-sign-in"></i>
{% endif %}
{{ link(item.title, item.url) }}
{% if item.below %}
{{ menus.menu_links(item.below, attributes, menu_level + 1) }}
{% endif %}
</li>