Problem/Motivation
On #3087218-71: Help searches fail if site is not fully indexed, and users do not know why, catch requested
The code in help_topics_modules_uninstalled() could be moved to a _helper_function(), and that would save having to explain what we're doing here.
This code is located in the file core/modules/help_topics/help_topics.module.
More explanation:
On the parent issue, we implemented hook_modules_installed(), hook_themes_installed(), hook_modules_uninstalled(), and hook_themes_uninstalled(). All 4 needed to call some of the same code. The way it was implemented, we put the necessary code in hook_modules_uninstalled() and then called this function from the other 3.
What catch is asking for instead is that we make a helper function whose name starts with _help_topics_ to do the common operations, and call that instead from all four functions.
Steps to reproduce
Proposed resolution
Move the common code for these 4 hooks into a new helper function in help_topics.module whose function name starts with _help_topics_.
Remaining tasks
1. Make a patch to do the above.
2. Review the patch.
3. Commit the patch.
User interface changes
None.
API changes
Not really. Functions starting with _ are not part of the public API, and the same code will still be executed for each of these hooks.
Data model changes
None.
Release notes snippet
Not necessary.
Comment | File | Size | Author |
---|---|---|---|
#18 | 3209139-18.patch | 2.96 KB | andypost |
#18 | interdiff.txt | 943 bytes | andypost |
#13 | interdiff-12-13.txt | 2.13 KB | jhodgdon |
#13 | 3209139-13.patch | 2.94 KB | jhodgdon |
Comments
Comment #2
guilhermevp CreditAttribution: guilhermevp at CI&T commentedComment #3
guilhermevp CreditAttribution: guilhermevp at CI&T commentedSending patch. Please review.
Made the _helper_function() as requested by Catch and updated documentation as well.
Comment #4
andypost1) this function needs proper naming for example
_help_topics_search_update()
2) needs doc-block and removal of similar inline comments
Comment #5
guilhermevp CreditAttribution: guilhermevp at CI&T commentedComment #6
guilhermevp CreditAttribution: guilhermevp at CI&T commented@andypost thanks for the feedback!
Please review the new patch.
Comment #7
andypostIt should get
array $extensions
as argument but all calling places pass empty arrayComment #8
guilhermevp CreditAttribution: guilhermevp at CI&T commentedSending new patch.
Thanks again for the time and patience.
Comment #9
andypostGreat! Mostly done)
_helper_topics_search_update()
needs properly declared doc-block according to https://www.drupal.org/docs/develop/standards/api-documentation-and-comm...Comment #10
guilhermevp CreditAttribution: guilhermevp at CI&T commentedIs this the correct doc block format for this situation?
Comment #11
andypostAs it used for modules and themes we call it extension in core 8+
Comment #12
guilhermevp CreditAttribution: guilhermevp at CI&T commentedThanks for all the help. Sending patch for review.
Comment #13
jhodgdonThanks for the patch! I was going to review it but it was easier to make an interdiff. One big functional point: The array of extensions should only be passed in when modules are being uninstalled. Not for the other 3 cases. Anyway here is a fixed-up patch with a bunch of changes.
Comment #14
andypostThanks 👍 looks ready and should be green, OTOH array could use kinda
EntensionInterface[]
for doc blockComment #16
jhodgdonTest fail was in QuickEditFileTest. Looks like a random glitch.
Comment #17
jhodgdonI believe $extensions is an array of strings, not of extensions. It's not documented what it is here:
https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Extension...
But if you look at where it's invoked, you can see it's a plain array of strings:
https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Extension...
Comment #18
andypostSorry, I was wrong so here fix -
string[]
andvoid
to polish )Comment #19
jhodgdonChanges look good to me. You had already RTBC'd the previous patch, so I think it is OK for me to RTBC your changes.
Comment #21
catchCommitted fd56500 and pushed to 9.2.x. Thanks!