bootstrap_italia-8.x-0.x-dev/components/components-0x/button/button.twig

components/components-0x/button/button.twig
{#
/**
 * @file
 * Template for button pattern
 * Docs: https://italia.github.io/bootstrap-italia/docs/componenti/bottoni/
 * Latest revision: v2.5.0
 *
 * Available config:
 * + type: primary | secondary | success | danger | warning | info | light | dark
 * + outline: true | false
 * + tag: button, a, input
 * + classes: array | false
 * + value: string
 * + input_type: button | submit | reset
 * + attributes: Attributes array
 * + data_attributes: array
 * + size: xs | sm | lg
 * X block: true | false
 * + icon: it-name
 * + href: URL
 *
 * Migration note: for 'block' feature, read the docs at "A tutta larghezza" paragraph.
 */
#}
{% apply spaceless %}
  {% include '@bi-bcl/deprecated.html.twig' with {
    old: 'bootstrap_italia_components/button/button.twig',
    new: 'bi-bcl/button/button.html.twig',
  } %}

  {# Redirect to new component #}
  {% if attributes is not defined %}
    {% set old_button_attributes = create_attribute() %}
  {% endif %}
  {% for data, attribute in data_attributes %}
    {% set old_button_attributes = old_button_attributes.setAttribute('data-' ~ data, attribute) %}
  {% endfor %}

  {% if icon is defined and icon is not empty %}
    {% embed '@bi-bcl/button/button.html.twig' with {
      label: value ?? null,
      tag: tag ?? null,
      url: href ?? null,
      variant: type,
      type: input_type ?? null,
      outline: outline ?? null,
      size: size ?? null,
      button_classes: classes ?? null,
      button_attibutes: old_button_attributes,
    } %}
      {% block after %}
        {% include '@bi-bcl/icon/icon.html.twig' with {
          name: icon,
          color: 'white',
          icon_classes: ['ms-1'],
        } %}
      {% endblock %}
    {% endembed %}
  {% else %}
    {% include '@bi-bcl/button/button.html.twig' with {
      label: value ?? null,
      tag: tag ?? null,
      url: href ?? null,
      variant: type,
      type: input_type ?? null,
      outline: outline ?? null,
      size: size ?? null,
      button_classes: classes ?? null,
      button_attibutes: old_button_attributes,
    } %}
  {% endif %}
{% endapply %}

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

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