dsfr4drupal-1.x-dev/components/logo/logo.twig
components/logo/logo.twig
{% set attributes = attributes|default(create_attribute()) %}
{% set link_attributes = link_attributes|default(create_attribute()) %}
{% set has_link = has_link ?? true %}
{% set is_front = is_front ?? true %}
{% set text = text|default('République\nFrançaise') %}
{% if variant and variant != 'md' %}
{% set attributes = attributes.addClass('fr-logo--' ~ variant) %}
{% endif %}
{% if has_link %}
{% set t_args = {'@text': text|replace({"\n": ' '})} %}
{% if is_front %}
{% set link_title = link_title|default('Homepage - @text'|t(t_args)) %}
{% else %}
{% set link_title = link_title|default('Back to the homepage - @text'|t(t_args)) %}
{% endif %}
<a{{ link_attributes.setAttribute('href', path('<front>')).setAttribute('title', link_title) }}>
{% endif %}
<p{{ attributes.addClass('fr-logo') }}>
{{ text|nl2br }}
</p>
{% if has_link %}
</a>
{% endif %}
