grav/themes/materialize/templates/forms/fields/select/select.html.twig

26 lines
1.1 KiB
Twig
Raw Normal View History

{% set value = (value is null ? field.default : value) %}
<div class="form-field">
<label class="control-label col-sm-2">
{% if field.help %}
<span class="tooltip" data-asTooltip-position="w" title="{{ field.help|e }}">{{ field.label }}</span>
{% else %}
{{ field.label }}
{% endif %}
{{ field.validate.required in ['on', 'true', 1] ? '<span class="required">*</span>' }}
</label>
<div class="col-sm-10">
<select class="form-control" name="{{ (scope ~ field.name)|fieldName }}"
{% if field.autofocus in ['on', 'true', 1] %}autofocus="autofocus"{% endif %}
{% if field.novalidate in ['on', 'true', 1] %}novalidate="novalidate"{% endif %}
{% if field.validate.required in ['on', 'true', 1] %}required="required"{% endif %}
>
{% for key, text in field.options %}
<option {% if key == value %}selected="selected"{% endif %} value="{{ key }}">
{{ text }}
</option>
{% endfor %}
</select>
</div>
</div>