Closed (outdated)
Project:
Select (or other)
Version:
7.x-2.x-dev
Component:
Field widget (non-specific or listed)
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
31 Aug 2015 at 13:09 UTC
Updated:
9 Oct 2021 at 19:48 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
torotil commentedHere is a quick patch that defines defaults to fix the two most common notices for my sites.
todo:
Comment #3
legolasboThanks for your patch, let's complete the list of defaults and get this committed.
Comment #4
torotil commentedThis patch makes the following changes:
First I changed the part of the code that transfers the #properties from $element to $element['select'] to only transfer the properties that are present. After that the following #properties were still used (without checking for existence) in select_or_other_element_process(): #default_value, #options, #other_unknown_defaults, #other_delimiter, #multiple, #other, #attributes, #select_type.
This means that #attributes, #options, #other_unknown_defaults and #other_delimiter were missing. This patch defines them as follows:
Additionally processing related to #disabled can be dropped. It is propagated to child-elements automatically by form_builder(). The special case for #other_size is already handled by the loop a few lines above and can be dropped.
Comment #5
torotil commentedForgot to attach the patch.
Comment #6
torotil commentedComment #7
legolasboI don't see a default setting for #size. Doesn't this cause notices if #size isn't set?
Let's follow core's coding standards here and either put all values on the same line, or one value per line.
I would also like to see test coverage for this.
Comment #8
torotil commentedThe line with #size is removed in my patch - so no this won't throw notices ;)
Both true - I'd love to see test coverage too. But it seems that that's the limit of time that I can invest at this point. If you want anything more you'll need to find someone else to do it. BTW: this function seems to be perfectly unit-testable which is rather seldom in the Drupalverse.
Good luck!
Comment #9
legolasbo@torotil,
Thanks for your effort so far! I'm not sure when I have time to complete the work, but your efforts are greatly appreciated.
Comment #10
rimu commentedWorks for me. :D
Comment #11
daften commentedClosing as outdated because no activity in a long time and Drupal 7 goes EOL soon. Feel free to re-open if needed.