gridstack-8.x-2.5/templates/gridstack-box.html.twig

templates/gridstack-box.html.twig
{#
/**
 * @file
 * Default theme implementation for the individual GridStack box/item template.
 *
 * Available variables:
 * - attributes: An array of attributes to apply to the element.
 * - item.box: A renderable array of the main image/background, or empty if
 *   CSS background image is preferred.
 * - item.caption: A renderable array containing caption fields if provided:
 *   - title: The individual box title.
 *   - link: The box links or buttons.
 *   - data: any possible field for more complex data if crazy enough.
 * - settings: An array containing the given settings.
 *
 * @see template_preprocess_gridstack_box()
 */
#}
{%
  set classes = [
    'box--' ~ (delta + 1),
    settings.nested_id ? 'box--' ~ settings.nested_id,
    settings.layout ? 'box--caption--' ~ settings.layout|clean_class,
    settings.background ? 'box--background',
    settings.type ? 'box--' ~ settings.type|clean_class,
    item.box is empty ? 'box--empty',
  ]
%}
{%
  set content_classes = [
    'box__content',
  ]
%}
{%
  set caption_classes = [
    'box__caption',
  ]
%}
{% set content %}
  {% if settings.use_stamp %}
    <div class="box__stamp media media--ratio media--ratio--fluid">{{ item.box }}</div>
  {% else %}
    {{ item.box }}
  {% endif %}
{% endset %}
<{{ wrapper }}{{ attributes.addClass(classes) }}>
  {% if settings.use_inner %}
    <div{{ content_attributes.addClass(content_classes) }}>
  {% endif %}

    {{ content }}

    {% if item.caption %}
      <div{{ caption_attributes.addClass(caption_classes) }}>

        {% if item.caption.title %}
          <h2 class="box__title">{{ item.caption.title }}</h2>
        {% endif %}

        {% if item.caption.data or item.caption.alt %}
          <div class="box__description">
            {{ item.caption.data }}
            {{ item.caption.alt }}
          </div>
        {% endif %}

        {% if item.caption.link %}
          <div class="box__link">{{ item.caption.link }}</div>
        {% endif %}

      </div>

      {% if item.caption.category %}
        <div class="box__category">{{ item.caption.category }}</div>
      {% endif %}
    {% endif %}

  {% if settings.use_inner %}
    </div>
  {% endif %}
</{{ wrapper }}>

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

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