Closed (fixed)
Project:
Drupal core
Version:
10.1.x-dev
Component:
base system
Priority:
Minor
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
22 Feb 2023 at 15:40 UTC
Updated:
3 May 2023 at 10:09 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
catchComment #3
catchCouple more thoughts:
1. in the grouped case, would it be worth trying to use array_multisort() on the resulting array and skipping the initial asort(), didn't try this yet, might not be easier to read.
2. Should we split the method into getOptionsList() and getGroupedOptionsList() or something? But then we'd probably want a protected method for the shared logic, which means three methods instead of one, maybe that's fine though.
Comment #4
kim.pepperComment #5
catchLooking at #4, we now don't have a single call to ::getOptionsList(), so do we even need both versions? But grepping contrib it looks like it's used a lot with the default arguments, so maybe better to provide the 1-1 for now.
I think if we get this in before 10.1.x is released, we won't need a deprecation either way, can just update the CR from the other issue.
Comment #6
kim.pepperBy this I assume you mean having both methods as in the last patch?
Yep agreed.
So just need more reviews now?
Comment #7
catchI'm on the fence, but I think that means we could try to get this in and then open yet another follow-up to look at deprecating one if we want to.
Comment #8
longwaveWe should update this deprecation notice to add a reference to getGroupedOptionsList().
Not sure it is worth deprecating getOptionsList() given that getGroupedOptionsList() needs to call it and contrib appears to use it, it is a nice separation of concerns as it is.
Comment #9
kim.pepperFixes deprecation message.
Comment #11
kim.pepperComment #12
smustgrave commentedWill a change record be needed for getGroupedOptionsList()?
Shouldn't grouped be deprecated also?
Comment #13
longwave@smustgrave as this was only added recently in 10.1.x which is not yet released, it makes sense to add this extra method to the existing change record at https://www.drupal.org/node/3023528
Not sure what you mean by deprecating grouped, it is used in many places in core. The ungrouped version is not, but it is a nice separation of concerns.
The deprecation message is updated and there is nothing else to do here, so this is RTBC.
Comment #14
longwaveTagging for change record update.
Comment #15
catchI think @smustgrave is maybe referring to the $grouped parameter, but since the method was only added to 10.1 a week or so ago, we don't need to deprecate as long as this gets committed before 10.1.x beta1 since the change will only be from 10.0.x and earlier which doesn't have the method.
Comment #16
smustgrave commentedThat’s correct sorry for not specifying I meant parameter
Comment #17
catchUpdated the issue summary a bit.
Comment #18
catchStill small but slightly less small than when I opened the issue.
Comment #19
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #20
kim.pepperRe-roll of #9
Comment #21
kim.pepperBack to RTBC
Comment #23
kim.pepperRandom test fail
Comment #25
smustgrave commentedAnother random failure.
Comment #27
smustgrave commentedSurprise! Random failure.
Comment #28
alexpottThis looks like a really nice idea.
I think we can name this method a bit better. How about
getOptionsListByRegion()orgetOptionsListGroupedByRegion(). This would lead to more informative code. Discussed with @catch. We have a preference for the first option because it is more concise but maybe you'd expect that method to have a region argument. Maybe people have a better suggestion.Comment #29
kim.pepperHa ha. I think the current
getGroupedOptionsList()is easier to understand, but not a hill worth dying on.Comment #30
kim.pepperHere's a patch that renames to
getOptionsListByRegion().Comment #31
catch#30 looks good. I don't think there's that much in it, but I do prefer it slightly over the other options.
Comment #32
alexpottCommitted c312cc1 and pushed to 10.1.x. Thanks!
Comment #34
liquidcms commentedSorry if not the right place for this question but I am trying to modify the TZ list in D9.4. From the looks of things this is only possible by hacking core (like an alter function in the system_time_zones() function?). Is the work here going to make this any easier to accomplish in D10?
Comment #35
liquidcms commentedHmm, thought i would be smart and hack the system.module to add an alter to allow modifying the $zones. All i do in my alter is remove all the non-America optgroups. It works perfectly but form submit complains it is not a valid option. This isn't standard Drupal form processing is it. I should be able to remove items from a select list without issue.
Comment #36
quietone commentedThis is tagged for change record updates which still need to be done.
This issue should be added to the list of issues in the existing CR. And I see that the deprecation messages lists two alternate methods to use but only one is mentioned in the CR. The CR should have both and explain when to use one or the other. And examples are always useful.
Setting back to NW for the change record work.
Comment #37
feyp commentedUpdated the CR.
Comment #38
catchI also went to update the CR but cross-posed with FeyP - changes look better than mine so marking fixed.
Comment #39
quietone commented@FeyP, Thanks! That is much more informative and easy to read.
Comment #40
quietone commentedI forgot to remove the tag.
Comment #41
feyp commentedSince I didn't have luck asking in Slack...
Shouldn't the CR be published? The documentation on writing CRs says
so I would have expected this to happen on commit or in this case after the review. However maybe I'm missing something and we usually wait until release?
Comment #42
quietone commented@FeyP, yes it usually happens on commit but sometimes a committer forgets or gets called away. You are welcome to publish a Draft CR if the issue is fixed and there are not outstanding items. As always, add a comment to the issue when doing so. Which I will do now. :-)
I have published the CR.
Comment #43
feyp commented@quietone Thanks! I thought that it was just an oversight, but wasn't entirely sure. Will do in the future, if needed :)