-
Notifications
You must be signed in to change notification settings - Fork 821
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 up ListboxField #3767
fix up ListboxField #3767
Conversation
fix doc information on the __construct method allow SS_Map as source (just like parent class DropdownField) I am wondering if the set / get source method could be simpler - more like the dropdown field...
@sunnysideup Do you have an example setup that failed prior to this change? I just tested and |
Hi @kinglozzer , look at getSource, it checks for commas in arrays. That gave me an error. |
my pull request needs work, but I do think it needs fixing. I will make another one. |
Sorry, @sunnysideup, you’re quite right: for some reason I had warnings suppressed in my dev environment! 😳 What do you think of the following approach (casting $hasCommas = array_filter(
array_keys((array) $source),
create_function('$key', 'return strpos($key, ",") !== FALSE;')
); By doing it this way, the original Given that the parent class accepts either an |
Please can we get a test to prove this bug? |
Its doesn't strictly have to be an SS_Map, just something with ArrayAccess - https://github.com/silverstripe/silverstripe-framework/blob/master/forms/DropdownField.php#L122 |
closing due to age and because the root cause of this problem will be resolved by having a more consistent API with SS_List |
Also this field would have been changed when I did my listfield redux. ;) |
fix doc information on the __construct method
allow SS_Map as source (just like parent class DropdownField)
I am wondering if the set / get source method could be simpler - more like the dropdown field...