vartheme_bs5-2.0.x-dev/src/components/organisms/navbar/navbar-brand.twig
src/components/organisms/navbar/navbar-brand.twig
{#
/**
* @file
* Template for Navbar brand component.
*
* Available config:
* - text: the text to use for the brand.
* - path: the path for the link. Leave blank for no link.
* - image:
* - src: The source of the image
* - width: The width of the image
* - height: The height of the image
* - alt: The alternative text of the image
* - utility_classes: An array of utility classes.
*/
#}
{% import _self as navbar_brand %}
{% set utility_classes = utility_classes|join(' ') %}
{% if path %}
<a href="{{ path }}" class="navbar-brand d-flex align-items-center {{ utility_classes }}" aria-label="{{ text }}">
{% if image %}
{{ navbar_brand.image(image, width, height, alt) }}
{% endif %}
{{ text }}
</a>
{% else %}
<span class="navbar-brand h1 mb-0 {{ utility_classes }}" aria-label="{{ text }}">
{% if image %}
{{ navbar_brand.image(image, width, height, alt) }}
{% endif %}
{{ text }}
</span>
{% endif %}
{% macro image(src, width, height, alt) %}
{% set height_attr = height != 'auto' ? 'height="' ~ height ~ '"' %}
<img src="{{ src }}" {{ height_attr }} alt="{{ alt|default('') }}" class="me-2 w-100" />
{% endmacro %}
