File tree Expand file tree Collapse file tree 9 files changed +39
-0
lines changed Expand file tree Collapse file tree 9 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -212,6 +212,8 @@ the ``Choice`` constraint behave like a ``NotChoice`` constraint.
212212
213213.. include :: /reference/forms/types/options/placeholder.rst.inc
214214
215+ .. include :: /reference/forms/types/options/placeholder_attr.rst.inc
216+
215217.. include :: /reference/forms/types/options/preferred_choices.rst.inc
216218
217219Overridden Options
@@ -311,6 +313,8 @@ Field Variables
311313| placeholder | ``mixed `` | The empty value if not already in the list, otherwise |
312314| | | ``null ``. |
313315+----------------------------+--------------+-------------------------------------------------------------------+
316+ | placeholder_attr | ``array `` | The value of the `placeholder_attr `_ option. |
317+ +----------------------------+--------------+-------------------------------------------------------------------+
314318| choice_translation_domain | ``mixed `` | ``boolean ``, ``null `` or ``string `` to determine if the value |
315319| | | should be translated. |
316320+----------------------------+--------------+-------------------------------------------------------------------+
Original file line number Diff line number Diff line change @@ -81,6 +81,8 @@ These options inherit from the :doc:`ChoiceType </reference/forms/types/choice>`
8181
8282.. include :: /reference/forms/types/options/placeholder.rst.inc
8383
84+ .. include :: /reference/forms/types/options/placeholder_attr.rst.inc
85+
8486.. include :: /reference/forms/types/options/preferred_choices.rst.inc
8587
8688.. include :: /reference/forms/types/options/choice_type_trim.rst.inc
Original file line number Diff line number Diff line change @@ -62,6 +62,8 @@ These options inherit from the :doc:`ChoiceType </reference/forms/types/choice>`
6262
6363.. include :: /reference/forms/types/options/placeholder.rst.inc
6464
65+ .. include :: /reference/forms/types/options/placeholder_attr.rst.inc
66+
6567.. include :: /reference/forms/types/options/preferred_choices.rst.inc
6668
6769.. include :: /reference/forms/types/options/choice_type_trim.rst.inc
Original file line number Diff line number Diff line change @@ -256,6 +256,8 @@ Doctrine's Array Collection.
256256
257257.. include :: /reference/forms/types/options/placeholder.rst.inc
258258
259+ .. include :: /reference/forms/types/options/placeholder_attr.rst.inc
260+
259261``preferred_choices ``
260262~~~~~~~~~~~~~~~~~~~~~
261263
Original file line number Diff line number Diff line change @@ -78,6 +78,8 @@ These options inherit from the :doc:`ChoiceType </reference/forms/types/choice>`
7878
7979.. include :: /reference/forms/types/options/placeholder.rst.inc
8080
81+ .. include :: /reference/forms/types/options/placeholder_attr.rst.inc
82+
8183.. include :: /reference/forms/types/options/preferred_choices.rst.inc
8284
8385.. include :: /reference/forms/types/options/choice_type_trim.rst.inc
Original file line number Diff line number Diff line change @@ -98,6 +98,8 @@ These options inherit from the :doc:`ChoiceType </reference/forms/types/choice>`
9898
9999.. include :: /reference/forms/types/options/placeholder.rst.inc
100100
101+ .. include :: /reference/forms/types/options/placeholder_attr.rst.inc
102+
101103.. include :: /reference/forms/types/options/preferred_choices.rst.inc
102104
103105.. include :: /reference/forms/types/options/choice_type_trim.rst.inc
Original file line number Diff line number Diff line change @@ -75,6 +75,8 @@ These options inherit from the :doc:`ChoiceType </reference/forms/types/choice>`
7575
7676.. include :: /reference/forms/types/options/placeholder.rst.inc
7777
78+ .. include :: /reference/forms/types/options/placeholder_attr.rst.inc
79+
7880.. include :: /reference/forms/types/options/preferred_choices.rst.inc
7981
8082.. include :: /reference/forms/types/options/choice_type_trim.rst.inc
Original file line number Diff line number Diff line change 1+ ``placeholder_attr``
2+ ~~~~~~~~~~~~~~~~~~~~
3+
4+ **type**: ``array`` **default**: ``[]``
5+
6+ Use this to add additional HTML attributes to the placeholder choice::
7+
8+ use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
9+ // ...
10+
11+ $builder->add('fruits', ChoiceType::class, [
12+ // ...
13+ 'placeholder' => '...',
14+ 'placeholder_attr' => [
15+ ['title' => 'Choose an option'],
16+ ],
17+ ]);
18+
19+ .. versionadded:: 6.3
20+
21+ The ``placeholder_attr`` option was introduced in Symfony 6.3.
Original file line number Diff line number Diff line change @@ -92,6 +92,8 @@ These options inherit from the :doc:`ChoiceType </reference/forms/types/choice>`
9292
9393.. include :: /reference/forms/types/options/placeholder.rst.inc
9494
95+ .. include :: /reference/forms/types/options/placeholder_attr.rst.inc
96+
9597.. include :: /reference/forms/types/options/preferred_choices.rst.inc
9698
9799.. include :: /reference/forms/types/options/choice_type_trim.rst.inc
You can’t perform that action at this time.
0 commit comments