Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
field system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
12 Apr 2012 at 22:15 UTC
Updated:
17 Sep 2022 at 11:09 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
bojanz commentedLet's see what the core contributors think.
Comment #2
chimericdream commentedChanging title to match 8.x-dev bug report of this issue and backporting the patch from 8.x-dev.
See: https://drupal.org/node/1180992
Comment #3
swentel commentedNo need to have 2 issues with the same name. It needs to be fixed first in D8 anyway. You can post this patch over there, but leave the issue itself on 8.x because it needs to be fixed in that branch first.
Comment #4
swentel commentedSorry forget the link to the other issue: #1180992: [D8] list_field_validate() doesn't seem to accommodate select lists with <optgroup>
Comment #5
chimericdream commentedI think it makes more sense to make bug fixes in the current version first, then incorporate them into future releases. What is the rationale behind fixing next year's version while letting known bugs (especially ones with working patches) sit in the version people are using now?
Comment #6
chimericdream commented#2: core-fix_for_optgroups_in_options_list-1530486-2.patch queued for re-testing.
Comment #7
simon georges commentedClosed #1012640: Support grouping in allowed values for select list as a duplicate of this one.
Comment #8
m.stentaThis patch has been working for me in production for over a year. Marking this as RTBC...
Comment #9
stefan.r commentedIs this in Drupal 8 yet? If not it needs to go in there first
Comment #10
drummIt is not in D8 yet, #1180992: [D8] list_field_validate() doesn't seem to accommodate select lists with <optgroup>
Comment #11
dwwNot clear why this and #1180992: [D8] list_field_validate() doesn't seem to accommodate select lists with <optgroup> are separate issues. Seems like this one is duplicate. But for now, at least prefixing them with core major version so we can tell them apart.
Comment #12
dwwBeen testing this more locally, too. Solves the problems. Doesn't seem to cause any regressions.
I'm not sure how D7 handles test coverage for bug fixes like this. Tentatively setting to RTBC in the hopes this can make it into the next D7 core release. ;) If we need tests, please add the 'Needs tests' tag.
Thanks!
-Derek
Comment #13
poker10 commentedPatch #2 looks good, we are also using it.
I think that adding a test for this is simple, as the
allowed_values_functionis already being tested with thelist_test_allowed_values_callback(), which uses optgroups. Unfortunately only the first level key is being tested, so simpletest did not fails in that test. I have added additional test case to the patch from #2 and reuploading it with test only version. Patch itself is unchanged.Also we do not need to wait for D9 issue anymore, as it would not be commited. Similar code is already in D9, see: https://git.drupalcode.org/project/drupal/-/blob/9.5.x/core/modules/options/src/Plugin/Field/FieldType/ListItemBase.php#L50.
Comment #15
mcdruid commentedTests confirm that this looks good, thanks!
Comment #22
poker10 commentedThanks all!
Added also credits from the duplicate issue: #1012640: Support grouping in allowed values for select list