-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Fix docs after choice form type refactor #5755
Conversation
@@ -110,11 +110,12 @@ choice_label | |||
The ``choice_label`` option was introduced in Symfony 2.7. Prior to Symfony | |||
2.7, it was called ``property`` (which has the same functionality). | |||
|
|||
**type**: ``string`` | |||
**type**: ``string`` or a Closure |
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.
I would rather write string|Closure
instead.
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.
actually it should be null|callable|string|PropertyPath
see https://github.com/symfony/symfony/blob/2.8/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php#L352 and https://github.com/symfony/symfony/blob/2.8/src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php#L162
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.
exactly (see my comment below)
You can now also pass callables to the Furthermore, you can also pass any I think we should also add a @aivus I know this seems like a lot of work, but I think it can be done for one option and then duplicated for the others accordingly. Do you think you can make these changes? |
I believe this is also related to #5847. I mention that because we need to make these updates all at once, to make sure we've covered everything and done it correctly. |
…weaverryan) This PR was submitted for the 2.8 branch but it was merged into the 2.7 branch instead (closes #5876). Discussion ---------- Symfony 2.7 Form choice option update Hi guys! This replaces #5755 #5847 and should close #5179 (or at least covers most things). | Q | A | ------------- | --- | Doc fix? | yes | New docs? | yes | Applies to | 2.7+ | Fixed tickets | #5179 This is a big change, and I rewrote a lot. If you have time to review, I think it's best to read the published version up platform.sh and check the code for validity. You can see the code in a project that inspired all the examples here: https://github.com/weaverryan/form_choices/tree/finished. Commits ------- b55d170 typo! 70f5e85 tweaks thanks to comments 0ad7b18 fixing wrong image name 69fc3c3 removing scaling on images a2ad990 fixing bad reference 7aa4106 Completely re-working all the choice docs, including screenshots - for 2.7 changes 79c905c changing option order - choice_name and choice_value seem like edge cases 68725e8 Fixed preferred choices example e2dea88 Fixed linebreaking 889f123 Added choices_as_values description [amend] e1f583b Added choices_as_values description d3cf004 Added choice_loader basics 3763f71 Added basic choice type changes fd35e21 Fix docs related with choice form type refactor
Changes related with http://symfony.com/blog/new-in-symfony-2-7-choice-form-type-refactorization