annotate core/modules/system/templates/item-list.html.twig @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 4c8ae668cc8c
children
rev   line source
Chris@0 1 {#
Chris@0 2 /**
Chris@0 3 * @file
Chris@0 4 * Default theme implementation for an item list.
Chris@0 5 *
Chris@0 6 * Available variables:
Chris@0 7 * - items: A list of items. Each item contains:
Chris@0 8 * - attributes: HTML attributes to be applied to each list item.
Chris@0 9 * - value: The content of the list element.
Chris@0 10 * - title: The title of the list.
Chris@0 11 * - list_type: The tag for list element ("ul" or "ol").
Chris@0 12 * - wrapper_attributes: HTML attributes to be applied to the list wrapper.
Chris@0 13 * - attributes: HTML attributes to be applied to the list.
Chris@0 14 * - empty: A message to display when there are no items. Allowed value is a
Chris@0 15 * string or render array.
Chris@0 16 * - context: A list of contextual data associated with the list. May contain:
Chris@0 17 * - list_style: The custom list style.
Chris@0 18 *
Chris@0 19 * @see template_preprocess_item_list()
Chris@0 20 *
Chris@0 21 * @ingroup themeable
Chris@0 22 */
Chris@0 23 #}
Chris@0 24 {% if context.list_style %}
Chris@0 25 {%- set attributes = attributes.addClass('item-list__' ~ context.list_style) %}
Chris@0 26 {% endif %}
Chris@0 27 {% if items or empty %}
Chris@0 28 {%- if title is not empty -%}
Chris@0 29 <h3>{{ title }}</h3>
Chris@0 30 {%- endif -%}
Chris@0 31
Chris@0 32 {%- if items -%}
Chris@0 33 <{{ list_type }}{{ attributes }}>
Chris@0 34 {%- for item in items -%}
Chris@0 35 <li{{ item.attributes }}>{{ item.value }}</li>
Chris@0 36 {%- endfor -%}
Chris@0 37 </{{ list_type }}>
Chris@0 38 {%- else -%}
Chris@0 39 {{- empty -}}
Chris@0 40 {%- endif -%}
Chris@0 41 {%- endif %}