gridstack-box.html.twig in GridStack 8.2
Same filename and directory in other branches
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 also
1 theme call to gridstack-box.html.twig
- GridStackEnginePluginBase::buildItem in src/
GridStackEnginePluginBase.php - Returns an individual item.
File
templates/gridstack-box.html.twigView source
- {#
- /**
- * @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 = [
- settings.layout ? 'box--caption--' ~ settings.layout|clean_class,
- settings.empty ? 'box--empty',
- ]
- %}
- {%
- set caption_classes = [
- 'box__caption',
- ]
- %}
-
- <{{ wrapper }}{{ attributes.addClass(classes) }}>
-
- {# Allows background mode only, or prefacing content for layering to work. #}
- {{ item.preface }}
-
- {% if settings.use_inner %}
- <div{{ content_attributes }}>
- {% endif %}
-
- {{ item.box }}
-
- {% 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 }}>