Skip to content
Snippets Groups Projects

Issue #3449679 by Martygraphie: The button and no link routes and attributes are not retrieved from the url object in the menu_footer pattern

Open Issue #3449679 by Martygraphie: The button and no link routes and attributes are not retrieved from the url object in the menu_footer pattern
Files
2
@@ -6,25 +6,35 @@
{% set item_attributes = create_attribute(item_attributes) %}
<li{{ item_attributes.addClass('fr-footer__' ~ variant ~ '-item') }}>
{% set link_attributes = item.link_attributes|default({}) %}
{% set link_attributes = create_attribute(link_attributes) %}
{% set link_attributes = create_attribute(item.link_attributes|default({})) %}
{% set link_attributes = link_attributes.addClass('fr-footer__' ~ variant ~ '-link') %}
{% if item.url %}
{% set link_attributes = link_attributes.setAttribute('href', item.url) %}
{% if link_attributes.target == '_blank' %}
{% set link_attributes = link_attributes.setAttribute('title', '@title - new window'|t({'@title': link_attributes.title ?: item.title})) %}
{% endif %}
{% set is_button = (item.url == 'route:<button>') %}
{% set is_plain_text = (item.url == 'route:<nolink>') %}
{% if is_button %}
{% set link_attributes = link_attributes.setAttribute('type', 'button') %}
<button{{ link_attributes }}>
{{ item.title }}
</button>
{% elseif is_plain_text %}
<span{{ link_attributes }}>
{{ item.title }}
</span>
{% else %}
{% set link_attributes = link_attributes.setAttribute('href', item.url) %}
{% if link_attributes.target == '_blank' %}
{% set link_attributes = link_attributes.setAttribute('title', '@title - new window'|t({'@title': link_attributes.title ?: item.title})) %}
{% set link_attributes = link_attributes.setAttribute('rel', 'noopener external') %}
{% endif %}
<a{{ link_attributes }}>
{{ item.title }}
</a>
{% else %}
<span{{ link_attributes }}>
{{ item.title }}
</span>
{% endif %}
</li>
<a{{ link_attributes }}>
{{ item.title }}
</a>
{% endif %}
{% endif %}
</li>
{% endfor %}
</ul>
Loading