bootstrap_italia-8.x-0.x-dev/components/components-2/share/follow-us.html.twig

components/components-2/share/follow-us.html.twig
{#
/**
 * @file
 * Template for follow us component.
 * Docs: https://italia.github.io/bootstrap-italia/docs/menu-di-navigazione/header/#header-centrale
 * Latest revision: v2.6.1
 *
 * Parameters:
 * - socials (array) (default: '')
 *   - social-name
 *     - label (string)
 *     - url (url)
 * - label (string) (default: '')
 * - icon_color (string) (default: '')
 * - blank (boolean) (default: true)
 *   - Open link in new window
 * - followus_classes (array) (default: '')
 * - followus_attributes (obj attribute) (default: '')
 *
 * Examples:
   {% include '@bi-bcl/share/followus.html.twig' with {
      socials: socials,
      label: 'label',
      followus_classes: ['']
   } %}
 *
 */
#}
{% apply spaceless %}
  {# Set defaults #}
  {% set _label = label|default('') %}
  {% set _icon_color = icon_color|default('') %}
  {% set _blank = blank ?? true %}
  {% set _followus_classes = followus_classes|default('') %}
  {% set _followus_attributes = followus_attributes|default('') %}

  {# Set options #}
  {% set _classes = [
    ''
  ] %}

  {% if _followus_classes is not empty %}
    {% set _classes = _classes|merge(followus_classes) %}
  {% endif %}

  {% if _followus_attributes is empty %}
    {% set followus_attributes = create_attribute() %}
  {% endif %}
  {% set followus_attributes = followus_attributes
    .addClass(_classes)
  %}

  {# Component #}
  <div{{ followus_attributes }}>
    <span>{{ _label }}</span>
    <ul>
      {%- for social in socials -%}
        {%- if social.url -%}
          <li>
            {%- set social_attributes = create_attribute() -%}
            {%- set social_attributes = social_attributes
              .setAttribute('href', social.url)
              .setAttribute('rel', 'noopener')
              .setAttribute('aria-label', social.label)
              .addClass('text-'~_icon_color)
            -%}
            {%- if _blank -%}
              {%- set social_attributes = social_attributes
                .setAttribute('target', '_blank')
              -%}
            {%- endif -%}
            <a{{- social_attributes -}}>
              {%- include '@bi-bcl/icon/icon.html.twig' with {
                name: 'it-' ~ (social.label|lower),
                size: 'sm',
                color: _icon_color,
                icon_classes: ['align-top']
              } -%}
              <span class="visually-hidden-focusable">{{ social.label }}</span>
            </a>
          </li>
        {%- endif -%}
      {%- endfor -%}
    </ul>
  </div>
{% endapply %}

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

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