-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] Keep preferred_choices order for choice groups #34083
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
nicolas-grekas
merged 1 commit into
symfony:4.3
from
vilius-g:optgroup-preffered-ordering
Nov 28, 2019
Merged
[Form] Keep preferred_choices order for choice groups #34083
nicolas-grekas
merged 1 commit into
symfony:4.3
from
vilius-g:optgroup-preffered-ordering
Nov 28, 2019
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bf793b2
to
97ed3bf
Compare
nicolas-grekas
approved these changes
Nov 5, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(with minor CS comment)
src/Symfony/Component/Form/ChoiceList/Factory/DefaultChoiceListFactory.php
Outdated
Show resolved
Hide resolved
d33285a
to
0572b1d
Compare
d31120d
to
8afaaff
Compare
HeahDude
approved these changes
Nov 23, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
src/Symfony/Component/Form/ChoiceList/Factory/DefaultChoiceListFactory.php
Show resolved
Hide resolved
8afaaff
to
75404e5
Compare
Thank you @vilius-g. |
nicolas-grekas
added a commit
that referenced
this pull request
Nov 28, 2019
…ius-g) This PR was squashed before being merged into the 4.3 branch. Discussion ---------- [Form] Keep preferred_choices order for choice groups | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | Since 4.3 ordering of `preferred_choices` is preserved when displaying form. But this only works for flat options. When the choices are grouped, the preferred groups are in default order. Now the preferred choice group order is derived by taking the first matching choice from `preferred_choices` and using its position to sort the groups. Commits ------- 75404e5 [Form] Keep preferred_choices order for choice groups
This was referenced Dec 1, 2019
Merged
Merged
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since 4.3 ordering of
preferred_choices
is preserved when displaying form. But this only works for flat options. When the choices are grouped, the preferred groups are in default order.Now the preferred choice group order is derived by taking the first matching choice from
preferred_choices
and using its position to sort the groups.