select--gin-lb.html.twig in Gin Layout Builder 1.0.x
Theme override for a select element.
Available variables:
- attributes: HTML attributes for the <select> tag.
- options: The <option> element children.
See also
File
templates/form/select--gin-lb.html.twigView source
- {#
- /**
- * @file
- * Theme override for a select element.
- *
- * Available variables:
- * - attributes: HTML attributes for the <select> tag.
- * - options: The <option> element children.
- *
- * @see template_preprocess_select()
- */
- #}
- {% apply spaceless %}
- <select{{ glb_classes(attributes.addClass('form-element').addClass('form-element--type-select')) }}>
- {% for option in options %}
- {% if option.type == 'optgroup' %}
- <optgroup label="{{ option.label }}">
- {% for sub_option in option.options %}
- <option value="{{ sub_option.value }}"{{ sub_option.selected ? ' selected="selected"' }}>{{ sub_option.label }}</option>
- {% endfor %}
- </optgroup>
- {% elseif option.type == 'option' %}
- <option value="{{ option.value }}"{{ option.selected ? ' selected="selected"' }}>{{ option.label }}</option>
- {% endif %}
- {% endfor %}
- </select>
- {% endapply %}