Problem/Motivation
Hooks should be updated to match grouping standards in [meta] Standardize and clean up hook classes in core.
Steps to reproduce
n/a
Proposed resolution
Split out the TaxonomyHooks class, making theme and help new single hook classes, and entity actions a new grouped hook class.
Remaining tasks
Address feedback on MR
Manually convert: taxonomy_theme_suggestions_taxonomy_term, I'd probably put it in with the theme hook
Determine whether to set $config in the constructor or a helper function in TaxonomyEntityHooks.php.
Deprecate taxonomy_build_node_index() and taxonomy_delete_node_index().
User interface changes
None
Introduced terminology
None
API changes
None
Data model changes
None
Release notes snippet
None
| Comment | File | Size | Author |
|---|---|---|---|
| #56 | 3502014-nr-bot.txt | 2.44 KB | needs-review-queue-bot |
Issue fork drupal-3502014
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
mcgovernm commentedComment #4
oily commentedComment #5
nicxvan commented@oily, please make sure when you're editing the issue summary you're reviewing what is actually needed, there are definitely remaining tasks for this issue, they are just not added yet.
Comment #6
nicxvan commented@mcgovernm this is a great first step!
I think there are a couple of things we want to do in these that we wouldn't normally do for organization since they are hooks.
1. Add the appropriate return types for the methods if they do not exist.
2. Add dependency injection.
These are autowired, in case you are not familiar with in general it means you should be able to just add a use statement for the interface of the service you need, then add that service to the constructor.
Let me know if you have any questions!
I'll take a deeper look later.
Comment #7
quietone commentedComment #8
mcgovernm commentedComment #9
oily commented@nicxvan wrt #5
I did not edit 'Remaining tasks'. It is blank. If you are referring to the other fields, I filled them based on what I thought appropriate. 'None' could be thought of as 'None' ever or 'None' just now.
It is important to keep the issue summary as clear and up-to-date as possible so that people can get involved with the issue at all stages (ideally) and easily understand what it is about. Otherwise you restrict it to people who are 'in the know' ie those who have floated around in the wine vat of the issue for the duration of its maturation.
I think if we operated issues like a production line rather than a brewing process efficiency would improve.
Comment #10
nicxvan commentedYou did add none to remaining tasks:
https://www.drupal.org/node/3502014/revisions/view/13865170/13865177
I removed it in comment 5.
You did the same in this issue here too: #3493813: Drupal\Core\Theme\ComponentNegotiator::negotiate uses a lot of memory
I agree keeping issue summaries up to date is useful, I'm not trying to discourage you from updating them.
I am trying to encourage you to review the actual issue and provide relevant updates.
There are remaining tasks both in this issue and the other, no need to write them or if you don't know what they are, but none is not accurate.
Feel free to ping me in slack if you have more questions, I'm happy to chat more, but no need to add to this issue.
Comment #11
oily commented@nicxvan RE: #10 I did not realise you had had to redo. I dont want to create work for others. So I agree, I will be more circumspect about completing issue summaries.
Comment #12
nicxvan commentedtaxonomy_theme_suggestions_taxonomy_term can be manually converted, the rector rule missed all theme suggestions.
Comment #13
mcgovernm commentedTests started failing after adding the return type to hook_help in this commit. I have not been able to figure out why this would change anything.
Line 75 of PerformanceTest.php:
$this->assertSame(60, $performance_data->getCacheGetCount());Comment #14
nicxvan commentedI wouldn't worry about it, unless you think this is ready for review at the moment. It's most likely an upstream change affecting that and will be fixed separately.
When I see these I usually try to track down the issue that introduced it, and open an issue to resolve it, but that's not strictly necessary if you're still working on other feedback on the issue.
Comment #17
mcgovernm commentedComment #18
mcgovernm commentedPutting back to needs work, as taxonomy_theme_suggestions_taxonomy_term still needs to be addressed.
Comment #19
mcgovernm commentedComment #20
nicxvan commentedSorry which branch? Can you hide the ones you're not using?
Comment #23
nicxvan commentedLooks great!
Couple of comments, I didn't provide a lot of detail feel free to ping me on slack if you need clarification.
Comment #24
mcgovernm commentedComment #25
nicxvan commentedI think this needs a clean rebase.
Comment #26
nicxvan commentedSorry I was looking at the old MR, is this ready for review again?
Comment #27
mcgovernm commentedThanks! This is ready for review again. I had moved the setting of $config to a helper function, but wasn't sure after the last couple of comments on the MR if that was necessary or if it could have been left in the constructor for this case.
Comment #28
nicxvan commentedHelper is good!
Comment #29
smustgrave commentedHaven't reviewed because @nicxvan seems to be on it but love the file structure picked here.
Comment #30
mcgovernm commentedComment #31
nicxvan commentedI think this is closer, I hate to say it, I think we came up with a decent rubric for the split in the meta: #3493453-25: [meta] Standardize and clean up hook classes in core
I know you've been putting a lot towards this, but can we split the files based on the new thoughts I linked? Once that is in I think it's ready for a final review.
Comment #32
mcgovernm commentedThanks for the feedback! I think it was just two classes that needed to be renamed based on the text file, this is ready for review.
Comment #33
nicxvan commentedTwo minor comments you can merge in then I think it's ready!
Comment #34
nicxvan commentedGreat thanks!
Comment #35
berdirgetConfig() is still broken. It does not return a Config object, it returns the ConfigFactory because the condition there is never TRUE to go inside the if condition.
It works because it does not have a return type, which I'm not sure why phpstan doesn't complain a about.
The tests pass because what actually happens is that it returns a new config object for the non-existing maintain_index_table config and that evaluates to true. We have no tests that disable this flag.
drop the if, add an explicit return type, and just make it a one-liner to return that config. Since that's the only config key we care about, I'd actually suggest to rename the method to something like shouldMaintainIndexTable() and directly return a boolean from that.
Comment #36
nicxvan commentedOh great catch, yes we need to do that too.
Comment #37
mcgovernm commentedThank you @berdir! I've just pushed a commit to address that. I also noticed we still need to remove taxonomy_build_node_index and taxonomy_delete_node_index from taxonomy.module since they've been moved to TaxonomyEntityHooks. I should be able to get to that shortly.
Comment #38
berdirUnsure about the helper functions. Unlike some others, they are not underscore-prefixed nor are they hooks, so technically they are an API. in https://git.drupalcode.org/project/drupal/-/merge_requests/10999#note_45... I proposed to keep them but deprecate them for D12.
Comment #39
nicxvan commentedYeah those need to be deprecated.
Comment #40
mcgovernm commentedComment #41
mcgovernm commentedComment #42
mcgovernm commentedComment #43
nicxvan commentedTwo minor comments! Getting pretty close again
Comment #44
nicxvan commentedMade suggestions for all of the things that need tweaking I think.
Comment #45
berdirFWIW, I specifically suggested to not introduce a helper service for the node indexing and keep them as protected functions. It's not an API that taxonomy module offers, so it makes more sense to me as protected methods. Yes, the logic is duplicated then on the functions, but I don't think there is a rule against that.
No big deal I suppose, but that's how I would have done it.
Comment #46
nicxvan commentedDid you mean in a comment on the MR? I don't see that recommendation in these comments.
Comment #47
berdirIn https://git.drupalcode.org/project/drupal/-/merge_requests/10999#note_45..., yes.
Comment #49
mcgovernm commentedThank you @berdir. I've created a new branch and on it rolled back the commit that moved it to a service. New draft MR is here. Hopefully I've deprecated these correctly, I assume we'll need to update the CR to indicate these have been moved to protected methods?
Diff between new and current MR
3502014-EntityHooks has them in a service, 3502014-EntityHooks-2 has them as protected methods.
Comment #50
mcgovernm commentedComment #52
nicxvan commentedI updated the CR and hid the other approach, I think this looks good but I want to give @berdir a chance to look.
Comment #53
nicxvan commentedI think this is safe to RTBC again!
Comment #54
dwwLooks really good, thanks!
Mostly documentation nits, but a few param types which would be good to sort out before we commit and ship this.
Comment #55
mcgovernm commentedComment #56
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #57
mcgovernm commentedUpdated comment that was too long to pass core commits. Marking as needs review again.
Comment #58
nicxvan commentedI think everything has been addressed again!
Comment #59
xjmI feel like this issue is a good place for me to mention that the core Taxonomy module is seeking a subsystem maintainer! :)
Comment #60
nicxvan commentedThis is going to be a rebase and the deprecation needs to be updated to 11.3.0.
I don't think this counts as a disruptive deprecation so I assume 12.0.0 is fine for removal.
Comment #61
nicxvan commentedSorry, should be needs work for the reroll.
Comment #64
nicxvan commentedI thought this had gotten in!
The bulk conversion got the suggestions, let me rebase this, I think we could get this in.
Comment #67
nicxvan commentedRebase was pretty clean, I updated the deprecation version, I don't think those two functions are particularly disruptive so I left them at 12.
build node index is only called in https://www.drupal.org/project/private_taxonomy which has no supported drupal release.
delete node index is called in https://www.drupal.org/project/taxonomy_deep_index which also has no supported drupal release.
mcgovernm has put a ton of effort in, let's get this across the finish line.
Comment #68
dwwInitial pass at saving credit:
@mcgovernm for (almost) all the code
@nicxvan for heavy reviews, the rebases, and some of the code
@berdir and myself for detailed MR reviews
At this point, none of the other commenters here seem to reach the level of "creditable contribution", at least to my eyes.
Comment #69
dwwThis is really quite close. Opened some more MR nits. I don't see anything else to improve in here.
Also, edited the CR since this is 11.3 material at this point.
Comment #70
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #71
nicxvan commentedComment #72
dwwI've been over the MR multiple times with a fine-toothed comb. All but one of my concerns have been addressed, or at least follow-ups opened. The remaining open thread could also be a follow-up, it's a very minor nit about
defgroupand I'm not entirely sure how relevant those tags even are anymore. But I'll leave it open for a committer to review before merging this.Latest pipeline is mostly green. The Validatable config job is failing, but this MR isn't changing anything about config validation, so I don't think it's worth investigating why that job failed.
I could probably come up with some more hyper-pedantic nits if I really tried, but I'm trying to relax that approach. 😂 Progress is better than stalled perfection, so let's get this in and move on.
Thanks!
-Derek
Comment #73
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".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.