views/macros/select field: add support for custom value/display options
This commit is contained in:
parent
e046a77aa8
commit
c32048e047
@ -65,7 +65,8 @@
|
|||||||
{% elseif type == 'select' %}
|
{% elseif type == 'select' %}
|
||||||
<select name="{{ name }}" id="field-{{ name }}" {{ validation_attributes|safe }}>
|
<select name="{{ name }}" id="field-{{ name }}" {{ validation_attributes|safe }}>
|
||||||
{% for option in extraData %}
|
{% for option in extraData %}
|
||||||
<option value="{{ option }}" {{ 'selected' if value == option }}>{{ option }}</option>
|
<option value="{% if option.display === undefined or option.value !== undefined %}{{ option.value | default(option) }}{% endif %}"
|
||||||
|
{{ 'selected' if value == (option.value | default(option)) }}>{{ option.display | default(option) }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
<i data-feather="chevron-down"></i>
|
<i data-feather="chevron-down"></i>
|
||||||
|
Loading…
Reference in New Issue
Block a user