Skip to content
Snippets Groups Projects
Commit 794f6116 authored by William Haslag's avatar William Haslag Committed by Florent Torregrosa
Browse files

Issue #3292511 by b-haslag, Grimreaper: Bootstrap 5 : Forms > Select

parent f266253a
Branches
Tags
1 merge request!34Issue #3292511: Bootstrap 5 : Forms > Select
......@@ -24,32 +24,21 @@
{{ prefix }}
{% endif %}
{# Browsers do not recognize pseudo :after selectors, we must create a wrapper
# around the select element to style it properly.
# @see http://stackoverflow.com/q/21103542
#}
{% if not attributes.offsetExists('multiple') %}
<div class="select-wrapper">
{% endif %}
{% set classes = ['form-control'] %}
<select{{ attributes.addClass(classes) }}>
{% 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>
{% if not attributes.offsetExists('multiple') %}
</div>
{% endif %}
<select{{ attributes.addClass('form-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>
{% if suffix %}
{{ suffix }}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment