diff --git a/reference/forms/types/choice.rst b/reference/forms/types/choice.rst index 69830ddf7c5..ba692cae826 100644 --- a/reference/forms/types/choice.rst +++ b/reference/forms/types/choice.rst @@ -30,6 +30,7 @@ To use this field, you must specify *either* ``choices`` or ``choice_loader`` op | Overridden | - `compound`_ | | options | - `empty_data`_ | | | - `error_bubbling`_ | +| | - `trim`_ | +-------------+------------------------------------------------------------------------------+ | Inherited | - `attr`_ | | options | - `by_reference`_ | @@ -106,7 +107,7 @@ method:: 'choice_attr' => function($category, $key, $index) { return ['class' => 'category_'.strtolower($category->getName())]; }, - + 'group_by' => function($category, $key, $index) { // randomly assign things into 2 groups return rand(0, 1) == 1 ? 'Group A' : 'Group B'; @@ -323,6 +324,8 @@ error_bubbling Set that error on this field must be attached to the field instead of the parent field (the form in most cases). +.. include:: /reference/forms/types/options/choice_type_trim.rst.inc + Inherited Options ----------------- diff --git a/reference/forms/types/country.rst b/reference/forms/types/country.rst index 1c5ddd08c9b..37c63782443 100644 --- a/reference/forms/types/country.rst +++ b/reference/forms/types/country.rst @@ -33,6 +33,7 @@ you should just use the ``choice`` type directly. | | - `multiple`_ | | | - `placeholder`_ | | | - `preferred_choices`_ | +| | - `trim`_ | | | | | | from the :doc:`form ` type | | | | @@ -80,6 +81,8 @@ type: .. include:: /reference/forms/types/options/preferred_choices.rst.inc +.. include:: /reference/forms/types/options/choice_type_trim.rst.inc + These options inherit from the :doc:`form ` type: diff --git a/reference/forms/types/currency.rst b/reference/forms/types/currency.rst index 4ca2fdf72aa..6715253edd7 100644 --- a/reference/forms/types/currency.rst +++ b/reference/forms/types/currency.rst @@ -26,6 +26,7 @@ you should just use the ``choice`` type directly. | | - `multiple`_ | | | - `placeholder`_ | | | - `preferred_choices`_ | +| | - `trim`_ | | | | | | from the :doc:`form ` type | | | | @@ -70,6 +71,8 @@ type: .. include:: /reference/forms/types/options/preferred_choices.rst.inc +.. include:: /reference/forms/types/options/choice_type_trim.rst.inc + These options inherit from the :doc:`form` type: diff --git a/reference/forms/types/entity.rst b/reference/forms/types/entity.rst index 1087d2b3bcf..70b5029ce42 100644 --- a/reference/forms/types/entity.rst +++ b/reference/forms/types/entity.rst @@ -32,6 +32,7 @@ objects from the database. | | - `placeholder`_ | | | - `preferred_choices`_ | | | - `translation_domain`_ | +| | - `trim`_ | | | | | | from the :doc:`form ` type: | | | | @@ -264,6 +265,8 @@ type: .. include:: /reference/forms/types/options/choice_type_translation_domain.rst.inc +.. include:: /reference/forms/types/options/choice_type_trim.rst.inc + These options inherit from the :doc:`form ` type: diff --git a/reference/forms/types/language.rst b/reference/forms/types/language.rst index 0156d101e09..d0bc7a637e5 100644 --- a/reference/forms/types/language.rst +++ b/reference/forms/types/language.rst @@ -35,6 +35,7 @@ you should just use the ``choice`` type directly. | | - `multiple`_ | | | - `placeholder`_ | | | - `preferred_choices`_ | +| | - `trim`_ | | | | | | from the :doc:`form ` type | | | | @@ -82,6 +83,8 @@ type: .. include:: /reference/forms/types/options/preferred_choices.rst.inc +.. include:: /reference/forms/types/options/choice_type_trim.rst.inc + These options inherit from the :doc:`form ` type: diff --git a/reference/forms/types/locale.rst b/reference/forms/types/locale.rst index 7a27e81ae41..2aae1712383 100644 --- a/reference/forms/types/locale.rst +++ b/reference/forms/types/locale.rst @@ -36,6 +36,7 @@ you should just use the ``choice`` type directly. | | - `multiple`_ | | | - `placeholder`_ | | | - `preferred_choices`_ | +| | - `trim`_ | | | | | | from the :doc:`form ` type | | | | @@ -83,6 +84,8 @@ type: .. include:: /reference/forms/types/options/preferred_choices.rst.inc +.. include:: /reference/forms/types/options/choice_type_trim.rst.inc + These options inherit from the :doc:`form ` type: diff --git a/reference/forms/types/options/choice_type_trim.rst.inc b/reference/forms/types/options/choice_type_trim.rst.inc new file mode 100644 index 00000000000..999a33ef6bc --- /dev/null +++ b/reference/forms/types/options/choice_type_trim.rst.inc @@ -0,0 +1,7 @@ +trim +~~~~ + +**type**: ``boolean`` **default**: ``false`` + +Trimming is disabled by default because the selected value or values must match +the given choice values exactly (and they could contain whitespaces). diff --git a/reference/forms/types/timezone.rst b/reference/forms/types/timezone.rst index cf937bf80a8..4d90b16661d 100644 --- a/reference/forms/types/timezone.rst +++ b/reference/forms/types/timezone.rst @@ -27,6 +27,7 @@ you should just use the ``choice`` type directly. | | - `multiple`_ | | | - `placeholder`_ | | | - `preferred_choices`_ | +| | - `trim`_ | | | | | | from the :doc:`form ` type | | | | @@ -72,6 +73,8 @@ type: .. include:: /reference/forms/types/options/preferred_choices.rst.inc +.. include:: /reference/forms/types/options/choice_type_trim.rst.inc + These options inherit from the :doc:`form ` type: