dsfr4drupal-1.x-dev/components/alert/alert.twig

components/alert/alert.twig
{% set attributes = attributes|default(create_attribute()) %}
{% set title_tag = title_tag|default('h3') %}

{% if variant and variant != 'md' %}
  {% set attributes = attributes.addClass('fr-alert--' ~ variant) %}
{% endif %}

{% if type and type != 'default' %}
  {% set attributes = attributes.addClass('fr-alert--' ~ type) %}
{% elseif icon %}
  {% set attributes = attributes.addClass('fr-icon-' ~ icon) %}
{% endif %}

<div{{ attributes.addClass('fr-alert') }}>
  {% if title %}
    <{{ title_tag }} class="fr-alert__title">{{ title }}</{{ title_tag }}>
  {% endif %}

  {{ content }}

  {% if has_button %}
    {% set button_label = button_label|default('Hide message'|t) %}
    {% set button_title = button_title|default('Hide message'|t) %}

    <button type="button" class="fr-btn--close fr-btn" title="{{ button_title }}" onclick="const alert = this.parentNode; alert.parentNode.removeChild(alert)">
      {{ button_label }}
    </button>
    {{ attach_library('dsfr4drupal/component.button') }}
  {% endif %}
</div>

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc