Skip to content

Commit 75d2c05

Browse files
committed
[Form][ChoiceType] Add placeholder_attr field option
1 parent 45f9070 commit 75d2c05

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Resources/views/Form/form_div_layout.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
{%- endif -%}
6262
<select {{ block('widget_attributes') }}{% if multiple %} multiple="multiple"{% endif %}>
6363
{%- if placeholder is not none -%}
64-
<option value=""{% if required and value is empty %} selected="selected"{% endif %}>{{ placeholder != '' ? (translation_domain is same as(false) ? placeholder : placeholder|trans({}, translation_domain)) }}</option>
64+
<option value=""{% if placeholder_attr|default({}) %}{% with { attr: placeholder_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}{% if required and value is empty %} selected="selected"{% endif %}>{{ placeholder != '' ? (translation_domain is same as(false) ? placeholder : placeholder|trans({}, translation_domain)) }}</option>
6565
{%- endif -%}
6666
{%- if preferred_choices|length > 0 -%}
6767
{% set options = preferred_choices %}

Resources/views/Form/foundation_5_layout.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@
156156
{%- endif -%}
157157
<select {{ block('widget_attributes') }}{% if multiple %} multiple="multiple" data-customforms="disabled"{% endif %}>
158158
{% if placeholder is not none -%}
159-
<option value=""{% if required and value is empty %} selected="selected"{% endif %}>{{ translation_domain is same as(false) ? placeholder : placeholder|trans({}, translation_domain) }}</option>
159+
<option value=""{% if placeholder_attr|default({}) %}{% with { attr: placeholder_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}{% if required and value is empty %} selected="selected"{% endif %}>{{ translation_domain is same as(false) ? placeholder : placeholder|trans({}, translation_domain) }}</option>
160160
{%- endif %}
161161
{%- if preferred_choices|length > 0 -%}
162162
{% set options = preferred_choices %}

0 commit comments

Comments
 (0)