Skip to content

Commit

Permalink
Merge pull request #7 from mybuilder/separate-placeholder-empty-value
Browse files Browse the repository at this point in the history
Separate out check for placeholder and empty_value
  • Loading branch information
rainerkraftmb authored Oct 17, 2018
2 parents 2b30c3b + 23174ef commit 08c31ae
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Resources/views/Form/fields.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@
{{ block('widget_addon') }}
{% endif %}
<select {{ block('widget_attributes') }}{% if multiple %} multiple="multiple"{% endif %}>
{% if (placeholder is defined and placeholder is not none) or (empty_value is defined and empty_value is not none) %}
{% if placeholder is defined and placeholder is not none %}
<option value=""{% if required and value is empty %} selected="selected"{% endif %}>{{ placeholder|trans({}, translation_domain) }}</option>
{% elseif empty_value is defined and empty_value is not none %}
<option value=""{% if required and value is empty %} selected="selected"{% endif %}>{{ empty_value|trans({}, translation_domain) }}</option>
{% endif %}
{% if preferred_choices|length > 0 %}
Expand Down

0 comments on commit 08c31ae

Please sign in to comment.