Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions reference/forms/types/choice.rst
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ the ``Choice`` constraint behave like a ``NotChoice`` constraint.

.. include:: /reference/forms/types/options/placeholder.rst.inc

.. include:: /reference/forms/types/options/placeholder_attr.rst.inc

.. include:: /reference/forms/types/options/preferred_choices.rst.inc

Overridden Options
Expand Down Expand Up @@ -311,6 +313,8 @@ Field Variables
| placeholder | ``mixed`` | The empty value if not already in the list, otherwise |
| | | ``null``. |
+----------------------------+--------------+-------------------------------------------------------------------+
| placeholder_attr | ``array`` | The value of the `placeholder_attr`_ option. |
+----------------------------+--------------+-------------------------------------------------------------------+
| choice_translation_domain | ``mixed`` | ``boolean``, ``null`` or ``string`` to determine if the value |
| | | should be translated. |
+----------------------------+--------------+-------------------------------------------------------------------+
Expand Down
2 changes: 2 additions & 0 deletions reference/forms/types/country.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ These options inherit from the :doc:`ChoiceType </reference/forms/types/choice>`

.. include:: /reference/forms/types/options/placeholder.rst.inc

.. include:: /reference/forms/types/options/placeholder_attr.rst.inc

.. include:: /reference/forms/types/options/preferred_choices.rst.inc

.. include:: /reference/forms/types/options/choice_type_trim.rst.inc
Expand Down
2 changes: 2 additions & 0 deletions reference/forms/types/currency.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ These options inherit from the :doc:`ChoiceType </reference/forms/types/choice>`

.. include:: /reference/forms/types/options/placeholder.rst.inc

.. include:: /reference/forms/types/options/placeholder_attr.rst.inc

.. include:: /reference/forms/types/options/preferred_choices.rst.inc

.. include:: /reference/forms/types/options/choice_type_trim.rst.inc
Expand Down
2 changes: 2 additions & 0 deletions reference/forms/types/entity.rst
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ Doctrine's Array Collection.

.. include:: /reference/forms/types/options/placeholder.rst.inc

.. include:: /reference/forms/types/options/placeholder_attr.rst.inc

``preferred_choices``
~~~~~~~~~~~~~~~~~~~~~

Expand Down
2 changes: 2 additions & 0 deletions reference/forms/types/enum.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ These options inherit from the :doc:`ChoiceType </reference/forms/types/choice>`

.. include:: /reference/forms/types/options/placeholder.rst.inc

.. include:: /reference/forms/types/options/placeholder_attr.rst.inc

.. include:: /reference/forms/types/options/preferred_choices.rst.inc

.. include:: /reference/forms/types/options/choice_type_trim.rst.inc
Expand Down
2 changes: 2 additions & 0 deletions reference/forms/types/language.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ These options inherit from the :doc:`ChoiceType </reference/forms/types/choice>`

.. include:: /reference/forms/types/options/placeholder.rst.inc

.. include:: /reference/forms/types/options/placeholder_attr.rst.inc

.. include:: /reference/forms/types/options/preferred_choices.rst.inc

.. include:: /reference/forms/types/options/choice_type_trim.rst.inc
Expand Down
2 changes: 2 additions & 0 deletions reference/forms/types/locale.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ These options inherit from the :doc:`ChoiceType </reference/forms/types/choice>`

.. include:: /reference/forms/types/options/placeholder.rst.inc

.. include:: /reference/forms/types/options/placeholder_attr.rst.inc

.. include:: /reference/forms/types/options/preferred_choices.rst.inc

.. include:: /reference/forms/types/options/choice_type_trim.rst.inc
Expand Down
21 changes: 21 additions & 0 deletions reference/forms/types/options/placeholder_attr.rst.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
``placeholder_attr``
~~~~~~~~~~~~~~~~~~~~

**type**: ``array`` **default**: ``[]``

Use this to add additional HTML attributes to the placeholder choice::

use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
// ...

$builder->add('fruits', ChoiceType::class, [
// ...
'placeholder' => '...',
'placeholder_attr' => [
['title' => 'Choose an option'],
],
]);

.. versionadded:: 6.3

The ``placeholder_attr`` option was introduced in Symfony 6.3.
2 changes: 2 additions & 0 deletions reference/forms/types/timezone.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ These options inherit from the :doc:`ChoiceType </reference/forms/types/choice>`

.. include:: /reference/forms/types/options/placeholder.rst.inc

.. include:: /reference/forms/types/options/placeholder_attr.rst.inc

.. include:: /reference/forms/types/options/preferred_choices.rst.inc

.. include:: /reference/forms/types/options/choice_type_trim.rst.inc
Expand Down