Skip to content

Commit bbca3b0

Browse files
committed
[Form] Fixed ChoiceType trim option
1 parent 4491245 commit bbca3b0

File tree

7 files changed

+16
-1
lines changed

7 files changed

+16
-1
lines changed

reference/forms/types/choice.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ To use this field, you must specify *either* ``choices`` or ``choice_loader`` op
3030
| Overridden | - `compound`_ |
3131
| options | - `empty_data`_ |
3232
| | - `error_bubbling`_ |
33+
| | - `trim`_ |
3334
+-------------+------------------------------------------------------------------------------+
3435
| Inherited | - `attr`_ |
3536
| options | - `by_reference`_ |
@@ -106,7 +107,7 @@ method::
106107
'choice_attr' => function($category, $key, $index) {
107108
return ['class' => 'category_'.strtolower($category->getName())];
108109
},
109-
110+
110111
'group_by' => function($category, $key, $index) {
111112
// randomly assign things into 2 groups
112113
return rand(0, 1) == 1 ? 'Group A' : 'Group B';
@@ -323,6 +324,14 @@ error_bubbling
323324
Set that error on this field must be attached to the field instead of
324325
the parent field (the form in most cases).
325326

327+
trim
328+
~~~~
329+
330+
**type**: ``boolean`` **default**: ``false``
331+
332+
The trim is disabled by default for choices values.
333+
The reason is that a value must match a set of predefined one.
334+
326335
Inherited Options
327336
-----------------
328337

reference/forms/types/country.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ you should just use the ``choice`` type directly.
3333
| | - `multiple`_ |
3434
| | - `placeholder`_ |
3535
| | - `preferred_choices`_ |
36+
| | - `trim`_ |
3637
| | |
3738
| | from the :doc:`form </reference/forms/types/form>` type |
3839
| | |

reference/forms/types/currency.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ you should just use the ``choice`` type directly.
2626
| | - `multiple`_ |
2727
| | - `placeholder`_ |
2828
| | - `preferred_choices`_ |
29+
| | - `trim`_ |
2930
| | |
3031
| | from the :doc:`form </reference/forms/types/form>` type |
3132
| | |

reference/forms/types/entity.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ objects from the database.
3232
| | - `placeholder`_ |
3333
| | - `preferred_choices`_ |
3434
| | - `translation_domain`_ |
35+
| | - `trim`_ |
3536
| | |
3637
| | from the :doc:`form </reference/forms/types/form>` type: |
3738
| | |

reference/forms/types/language.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ you should just use the ``choice`` type directly.
3535
| | - `multiple`_ |
3636
| | - `placeholder`_ |
3737
| | - `preferred_choices`_ |
38+
| | - `trim`_ |
3839
| | |
3940
| | from the :doc:`form </reference/forms/types/form>` type |
4041
| | |

reference/forms/types/locale.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ you should just use the ``choice`` type directly.
3636
| | - `multiple`_ |
3737
| | - `placeholder`_ |
3838
| | - `preferred_choices`_ |
39+
| | - `trim`_ |
3940
| | |
4041
| | from the :doc:`form </reference/forms/types/form>` type |
4142
| | |

reference/forms/types/timezone.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ you should just use the ``choice`` type directly.
2727
| | - `multiple`_ |
2828
| | - `placeholder`_ |
2929
| | - `preferred_choices`_ |
30+
| | - `trim`_ |
3031
| | |
3132
| | from the :doc:`form </reference/forms/types/form>` type |
3233
| | |

0 commit comments

Comments
 (0)