-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] Add option widget to ChoiceType #15053
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
Conversation
Thanks for working on this @bamarni! You are right, the "multiple" option is implicitly set when "widget" is set. In fact, "multiple" and "expanded" should be deprecated and replaced by "widget". As soon as "widget" is set, "multiple" and "expanded" should not have any effect. |
What about the "text" widget then? In that case "multiple" was supposed to 2015-06-22 13:06 GMT+02:00 Bernhard Schussek [email protected]:
|
Ah good point :) Same for select, in fact. What about ignoring "multiple" then (and using a default) if "widget" is "checkbox" or "radio"? |
31591d9
to
b133772
Compare
@webmozart : While switching to "radio/checkbox" widgets I've faced an issue when adding a normalizer for the "multiple" option (cyclic reference). I think the only way to keep full BC here is to make the 'widget' option normalizing 'expanded' and 'multiple', without touching the code behind all this. Then we'll update the code when breaking BC, and set a normalizer for "multiple". What do you think? (cf. second commit). |
b133772
to
a63e3c2
Compare
Any change for getting this merged in 2.8? |
@Koc Unfortunately, we are waiting for @webmozart review. |
public function transform($array) | ||
{ | ||
if (null === $array) { | ||
return array(); |
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.
return '';
?
8fcf9fa
to
296ec8d
Compare
I just rebased and added more tests. According to the roadmap, now this can only land in the 3.X series right? |
296ec8d
to
5477d08
Compare
5477d08
to
02b1768
Compare
@webmozart Can you have a look at this one? The related issue is very old now with quite a few supporters. If we want it for 3.1, we should finish it as soon as possible. |
@fabpot 👍 From my pov except for the rebase it's finished, I was just waiting for feedback. |
|
||
protected function setUp() | ||
{ | ||
$this->transformer = new ValuesToStringTransformer(',', true); |
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.
We should have tests for other delimiters too.
Adding the behavior described here #6602, with another approach regarding radios and checkboxes though. When trying to implement it I noticed that the "multiple" option was kinda conflicting with the radio and checkbox widgets, because its value is implicit with them. So I think it would be better to stick to a more generic widget called "expanded", and the multiple option will decide whether it's a radio or a checkbox, it's similar to what we have currently and easier to implement. What do you think @webmozart?
Then I'll only need to rebase the old changes in #8112 about the entity type and it should be ok :)