iu-8.x-1.x-dev/templates/views/views-view-list.html.twig
templates/views/views-view-list.html.twig
{#
/**
* @file
* Theme override for a view template to display a list of rows.
*
* Leverage the "Feed items" IU Framework display style by default.
*
* Available variables:
* - attributes: HTML attributes for the container.
* - rows: A list of rows for this list.
* - attributes: The row's HTML attributes.
* - content: The row's contents.
* - title: The title of this group of rows. May be empty.
* - list: @todo.
* - type: Starting tag will be either a ul or ol.
* - attributes: HTML attributes for the list element.
*
* @see template_preprocess_views_view_list()
*/
#}
{{ attach_library('iu/feed-items') }}
{% if attributes -%}
<div{{ attributes }}>
{% endif %}
{% if title %}
<h3>{{ title }}</h3>
{% endif %}
{% set list_attributes = (list.attributes) ?: create_attribute() %}
{% set list_attributes = list_attributes.addClass('feed-items') %}
{% if list.type == 'ol' %}
{# Start the numbering of the ordered list from the correct result. #}
{% set start = view.pager.current_page * view.pager.options.items_per_page + 1 %}
{% set list_attributes = list_attributes.setAttribute('start', start) %}
{% endif %}
<{{ list.type }}{{ list_attributes }}>
{% for row in rows %}
{% set row_attributes = (row.attributes) ?: create_attribute() %}
{% set row_attributes = row_attributes.addClass('feed-item') %}
<li{{ row_attributes }}>{{ row.content }}</li>
{% endfor %}
</{{ list.type }}>
{% if attributes -%}
</div>
{% endif %}
