annotate core/modules/system/templates/select.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 a select element.
Chris@0 5 *
Chris@0 6 * Available variables:
Chris@0 7 * - attributes: HTML attributes for the <select> tag.
Chris@0 8 * - options: The <option> element children.
Chris@0 9 *
Chris@0 10 * @see template_preprocess_select()
Chris@0 11 *
Chris@0 12 * @ingroup themeable
Chris@0 13 */
Chris@0 14 #}
Chris@0 15 {% spaceless %}
Chris@0 16 <select{{ attributes }}>
Chris@0 17 {% for option in options %}
Chris@0 18 {% if option.type == 'optgroup' %}
Chris@0 19 <optgroup label="{{ option.label }}">
Chris@0 20 {% for sub_option in option.options %}
Chris@0 21 <option value="{{ sub_option.value }}"{{ sub_option.selected ? ' selected="selected"' }}>{{ sub_option.label }}</option>
Chris@0 22 {% endfor %}
Chris@0 23 </optgroup>
Chris@0 24 {% elseif option.type == 'option' %}
Chris@0 25 <option value="{{ option.value }}"{{ option.selected ? ' selected="selected"' }}>{{ option.label }}</option>
Chris@0 26 {% endif %}
Chris@0 27 {% endfor %}
Chris@0 28 </select>
Chris@0 29 {% endspaceless %}