- Issue created by @catch
- Status changed to Needs review
about 2 years ago 3:41pm 22 February 2023 - π¬π§United Kingdom catch
Couple 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.
- π¦πΊAustralia kim.pepper πββοΈπ¦πΊSydney, Australia
- I played around with array_multisort() but it's a mystery how it works
- Agree! I think this is a much better API. Added a patch that does this.
- π¬π§United Kingdom catch
Looking 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.
- π¦πΊAustralia kim.pepper πββοΈπ¦πΊSydney, Australia
so maybe better to provide the 1-1 for now.
By this I assume you mean having both methods as in the last patch?
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.
Yep agreed.
So just need more reviews now?
- π¬π§United Kingdom catch
By this I assume you mean having both methods as in the last patch?
I'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.
- Status changed to Needs work
about 2 years ago 1:11pm 24 February 2023 - π¬π§United Kingdom longwave UK
+++ b/core/modules/system/system.module @@ -1113,7 +1113,7 @@ function system_mail($key, &$message, $params) { @trigger_error(__METHOD__ . '() is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. This function is no longer used in Drupal core. Use \Drupal\Core\Datetime\TimeZoneFormHelper::getOptionsList() or \DateTimeZone::listIdentifiers() instead. See https://www.drupal.org/node/3023528', E_USER_DEPRECATED);
We 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.
- Status changed to Needs review
almost 2 years ago 8:49pm 26 February 2023 - π¦πΊAustralia kim.pepper πββοΈπ¦πΊSydney, Australia
Fixes deprecation message.
The last submitted patch, 9: 3343755-9.patch, failed testing. View results β
- πΊπΈUnited States smustgrave
Will a change record be needed for getGroupedOptionsList()?
Shouldn't grouped be deprecated also?
- π¬π§United Kingdom longwave UK
@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.
- Status changed to RTBC
almost 2 years ago 10:11pm 1 March 2023 - π¬π§United Kingdom catch
I 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.
- πΊπΈUnited States smustgrave
Thatβs correct sorry for not specifying I meant parameter
- π¬π§United Kingdom catch
Still small but slightly less small than when I opened the issue.
- Status changed to Needs work
almost 2 years ago 10:59am 19 March 2023 The last submitted patch, 20: 3343755-20.patch, failed testing. View results β
- Status changed to RTBC
almost 2 years ago 1:50am 20 March 2023 - π¦πΊAustralia kim.pepper πββοΈπ¦πΊSydney, Australia
Random test fail
The last submitted patch, 20: 3343755-20.patch, failed testing. View results β
The last submitted patch, 20: 3343755-20.patch, failed testing. View results β
- Status changed to Needs work
almost 2 years ago 10:39am 29 March 2023 - π¬π§United Kingdom alexpott πͺπΊπ
This looks like a really nice idea.
+++ b/core/lib/Drupal/Core/Datetime/TimeZoneFormHelper.php @@ -34,29 +32,44 @@ public static function getOptionsList(bool $blank = FALSE, bool $grouped = FALSE + public static function getGroupedOptionsList(bool $blank = FALSE): array {
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. - π¦πΊAustralia kim.pepper πββοΈπ¦πΊSydney, Australia
Ha ha. I think the current
getGroupedOptionsList()
is easier to understand, but not a hill worth dying on. - Status changed to Needs review
almost 2 years ago 12:14am 30 March 2023 - π¦πΊAustralia kim.pepper πββοΈπ¦πΊSydney, Australia
Here's a patch that renames to
getOptionsListByRegion()
. - Status changed to RTBC
almost 2 years ago 10:35am 30 March 2023 - π¬π§United Kingdom catch
#30 looks good. I don't think there's that much in it, but I do prefer it slightly over the other options.
- Status changed to Fixed
almost 2 years ago 8:54pm 30 March 2023 -
alexpott β
committed c312cc11 on 10.1.x
Issue #3343755 by kim.pepper, catch, smustgrave, longwave: Simplify...
-
alexpott β
committed c312cc11 on 10.1.x
- π¨π¦Canada liquidcms
Sorry 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?
- π¨π¦Canada liquidcms
Hmm, 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.
- Status changed to Needs work
almost 2 years ago 8:44am 14 April 2023 - π³πΏNew Zealand quietone
This 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.
- Status changed to Needs review
almost 2 years ago 11:40am 14 April 2023 - Status changed to Fixed
almost 2 years ago 11:47am 14 April 2023 - π¬π§United Kingdom catch
I also went to update the CR but cross-posed with FeyP - changes look better than mine so marking fixed.
- π³πΏNew Zealand quietone
@FeyP, Thanks! That is much more informative and easy to read.
- π©πͺGermany FeyP
Since I didn't have luck asking in Slack...
Shouldn't the CR be published? The documentation on writing CRs β says
(change records are published when the change is committed)
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?
- π³πΏNew Zealand quietone
@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.
- π©πͺGermany FeyP
@quietone Thanks! I thought that it was just an oversight, but wasn't entirely sure. Will do in the future, if needed :)
Automatically closed - issue fixed for 2 weeks with no activity.