ui_suite_daisyui-4.0.x-dev/components/button/button.twig

components/button/button.twig
{%
  set classes = [
    'btn',
    variant and variant != 'default' ? 'btn-' ~ variant,
    active ? 'btn-active',
    outline ? 'btn-outline',
    size ? 'btn-' ~ size,
    wide ? 'btn-wide',
    glass ? 'glass',
    square ? 'btn-square',
    circle ? 'btn-circle',
    _block ? 'btn-block',
  ]
%}

{% set icon_position = icon_position|default('right') %}

{% set attributes = attributes.addClass(classes) %}

{% if modal_id %}
  {% set attributes = attributes.setAttribute('onclick', modal_id ~ '.showModal()') %}
{% endif %}

{% if url or attributes.href %}
  {% set url = url|default(attributes.href) %}
  {% set attributes = attributes.setAttribute('href', url) %}
  {% if disabled %}
    {% set attributes = attributes.setAttribute('href', false).setAttribute('tabindex', '-1').setAttribute('aria-disabled', 'true').addClass('btn-disabled') %}
  {% endif %}
  <a{{ attributes.setAttribute('role', 'button') }}>
  {% if icon_position == 'left' %}
    {{ icon(icon.pack_id, icon.icon_id, icon.settings) }}
  {% endif %}
  {{ label }}
  {% if icon_position == 'right' %}
    {{ icon(icon.pack_id, icon.icon_id, icon.settings) }}
  {% endif %}
  </a>
{% else %}
  {% if disabled %}
    {% set attributes = attributes.setAttribute('disabled', 'disabled') %}
  {% endif %}
  <button{{ attributes }}>
  {% if icon_position == 'left' %}
    {{ icon(icon.pack_id, icon.icon_id, icon.settings) }}
  {% endif %}
  {{ label }}
  {% if icon_position == 'right' %}
    {{ icon(icon.pack_id, icon.icon_id, icon.settings) }}
  {% endif %}
  </button>
{% endif %}

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

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