annotate core/themes/stable/templates/form/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 * Theme override 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 #}
Chris@0 13 {% spaceless %}
Chris@0 14 <select{{ attributes }}>
Chris@0 15 {% for option in options %}
Chris@0 16 {% if option.type == 'optgroup' %}
Chris@0 17 <optgroup label="{{ option.label }}">
Chris@0 18 {% for sub_option in option.options %}
Chris@0 19 <option value="{{ sub_option.value }}"{{ sub_option.selected ? ' selected="selected"' }}>{{ sub_option.label }}</option>
Chris@0 20 {% endfor %}
Chris@0 21 </optgroup>
Chris@0 22 {% elseif option.type == 'option' %}
Chris@0 23 <option value="{{ option.value }}"{{ option.selected ? ' selected="selected"' }}>{{ option.label }}</option>
Chris@0 24 {% endif %}
Chris@0 25 {% endfor %}
Chris@0 26 </select>
Chris@0 27 {% endspaceless %}