views-rows-wrapper.html.twig in Views Rows Wrapper 8.2
Same filename and directory in other branches
Default theme implementation to output a views rows wrapper display style plugin.
Available variables:
- rows: A list of the view's row items.
- attributes: The row's HTML attributes.
- content: The row's content.
- view: The view object.
- element_type: Wrapper element type
- attribute_type: Attribute type of the selected wrapper element
- attribute_name: Name of the selected attribute.
- rows_number: A number of rows to wrap
- wrap_method: 0 - Apply to all items, 1 - Wrap once.
- use_wrapper: A flag for wrapper usage
- use_additional_wrapper: A flag for additional wrapper usage
File
templates/views-rows-wrapper.html.twigView source
- {#
- /**
- * @file
- * Default theme implementation to output a views rows wrapper display style plugin.
- *
- * Available variables:
- * - rows: A list of the view's row items.
- * - attributes: The row's HTML attributes.
- * - content: The row's content.
- * - view: The view object.
- * - element_type: Wrapper element type
- * - attribute_type: Attribute type of the selected wrapper element
- * - attribute_name: Name of the selected attribute.
- * - rows_number: A number of rows to wrap
- * - wrap_method: 0 - Apply to all items, 1 - Wrap once.
- * - use_wrapper: A flag for wrapper usage
- * - use_additional_wrapper: A flag for additional wrapper usage
- *
- * @ingroup themeable
- */
- #}
- {% if use_wrapper %}
- {% if use_additional_wrapper %}
- <div class="views-rows-wrapper">
- {% endif %}
- {% set k = 0 %}
- {% set is_wrapped_once = 0 %}
- {% for row in rows %}
- {% set k = k + 1 %}
- {% if (k == 1) and (is_wrapped_once == 0) %}
- {% if attribute_name %}
- <{{ element_type }} {{ attribute_type }} ="{{ attribute_name }}">
- {% else %}
- <{{ element_type }}>
- {% endif %}
- <div{{ row.attributes }}>
- {{ row.content }}
- </div>
- {% else %}
- <div{{ row.attributes }}>
- {{ row.content }}
- </div>
- {% endif %}
- {% if (loop.index is divisible by(rows_number)) or ((loop.index == loop.last) and (k < rows_number)) %}
- {% if is_wrapped_once == 0 %}
- </{{ element_type }}>
- {% endif %}
- {% endif %}
- {% if (k == rows_number) %}
- {% set k = 0 %}
- {% if (wrap_method == 1) %}
- {% set is_wrapped_once = 1 %}
- {% endif %}
- {% endif %}
- {% endfor %}
- {% if use_additional_wrapper %}
- </div>
- {% endif %}
- {% else %}
- {% for row in rows %}
- <div{{ row.attributes }}>
- {{ row.content }}
- </div>
- {% endfor %}
- {% endif %}