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 3 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
5 changes: 4 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`_ |
| | - `choice_type_trim`_ |
Copy link
Member

Choose a reason for hiding this comment

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

here we would still have to use trim

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Was not sure ^^. Fixed, thanks!

+-------------+------------------------------------------------------------------------------+
| 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,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
-----------------

Expand Down
3 changes: 3 additions & 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`_ |
| | - `choice_type_trim`_ |
| | |
| | from the :doc:`form </reference/forms/types/form>` type |
| | |
Expand Down Expand Up @@ -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 </reference/forms/types/form>`
type:

Expand Down
3 changes: 3 additions & 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`_ |
| | - `choice_type_trim`_ |
| | |
| | from the :doc:`form </reference/forms/types/form>` type |
| | |
Expand Down Expand Up @@ -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</reference/forms/types/form>`
type:

Expand Down
3 changes: 3 additions & 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`_ |
| | - `choice_type_trim`_ |
| | |
| | from the :doc:`form </reference/forms/types/form>` type: |
| | |
Expand Down Expand Up @@ -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 </reference/forms/types/form>`
type:

Expand Down
3 changes: 3 additions & 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`_ |
| | - `choice_type_trim`_ |
| | |
| | from the :doc:`form </reference/forms/types/form>` type |
| | |
Expand Down Expand Up @@ -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 </reference/forms/types/form>`
type:

Expand Down
3 changes: 3 additions & 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`_ |
| | - `choice_type_trim`_ |
| | |
| | from the :doc:`form </reference/forms/types/form>` type |
| | |
Expand Down Expand Up @@ -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 </reference/forms/types/form>`
type:

Expand Down
7 changes: 7 additions & 0 deletions reference/forms/types/options/choice_type_trim.rst.inc
Original file line number Diff line number Diff line change
@@ -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 white spaces).
Copy link
Member

Choose a reason for hiding this comment

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

"whitespaces" (without the space)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, fixed. Thanks again!

3 changes: 3 additions & 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`_ |
| | - `choice_type_trim`_ |
| | |
| | from the :doc:`form </reference/forms/types/form>` type |
| | |
Expand Down Expand Up @@ -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 </reference/forms/types/form>`
type:

Expand Down