Skip to content

[Form] Fixed ChoiceType trim option #9598

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 8, 2018
Merged
Show file tree
Hide file tree
Changes from 2 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
11 changes: 10 additions & 1 deletion reference/forms/types/choice.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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`_ |
Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -323,6 +324,14 @@ error_bubbling
Set that error on this field must be attached to the field instead of
the parent field (the form in most cases).

trim
~~~~
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should move the description to its own file to be able to reuse it in other form types. This is currently missing in some documents (see the failing build).


**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 white spaces).

Inherited Options
-----------------

Expand Down
1 change: 1 addition & 0 deletions reference/forms/types/country.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ you should just use the ``choice`` type directly.
| | - `multiple`_ |
| | - `placeholder`_ |
| | - `preferred_choices`_ |
| | - `trim`_ |
| | |
| | from the :doc:`form </reference/forms/types/form>` type |
| | |
Expand Down
1 change: 1 addition & 0 deletions reference/forms/types/currency.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ you should just use the ``choice`` type directly.
| | - `multiple`_ |
| | - `placeholder`_ |
| | - `preferred_choices`_ |
| | - `trim`_ |
| | |
| | from the :doc:`form </reference/forms/types/form>` type |
| | |
Expand Down
1 change: 1 addition & 0 deletions reference/forms/types/entity.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ objects from the database.
| | - `placeholder`_ |
| | - `preferred_choices`_ |
| | - `translation_domain`_ |
| | - `trim`_ |
| | |
| | from the :doc:`form </reference/forms/types/form>` type: |
| | |
Expand Down
1 change: 1 addition & 0 deletions reference/forms/types/language.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ you should just use the ``choice`` type directly.
| | - `multiple`_ |
| | - `placeholder`_ |
| | - `preferred_choices`_ |
| | - `trim`_ |
| | |
| | from the :doc:`form </reference/forms/types/form>` type |
| | |
Expand Down
1 change: 1 addition & 0 deletions reference/forms/types/locale.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ you should just use the ``choice`` type directly.
| | - `multiple`_ |
| | - `placeholder`_ |
| | - `preferred_choices`_ |
| | - `trim`_ |
| | |
| | from the :doc:`form </reference/forms/types/form>` type |
| | |
Expand Down
1 change: 1 addition & 0 deletions reference/forms/types/timezone.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ you should just use the ``choice`` type directly.
| | - `multiple`_ |
| | - `placeholder`_ |
| | - `preferred_choices`_ |
| | - `trim`_ |
| | |
| | from the :doc:`form </reference/forms/types/form>` type |
| | |
Expand Down