Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
In views_hook_info() the hook_views_analyze is assigned to the group => 'views', therefore all the implementation of hook_views_analyze should be declared in a .module file or in a .views.inc file. Node module implementation of hook_views_analyze is located in node.views_execution.inc, so it never executed
Proposed resolution
Move node_views_analyze() in node.views.inc
Remaining tasks
Write a patch
Comment | File | Size | Author |
---|---|---|---|
#43 | interdiff-39-43.txt | 511 bytes | g-brodiei |
#43 | 2586013-drupal8-43.patch | 11.64 KB | g-brodiei |
#39 | 2586013-39.patch | 11.65 KB | ayushmishra206 |
#39 | 2586013-39.patch | 11.65 KB | ayushmishra206 |
#31 | interdiff_26-31.txt | 1.63 KB | pameeela |
Comments
Comment #2
willzyx CreditAttribution: willzyx commentedmoreover this issue shows that there is not test coverage for this hook in the node module
Comment #3
willzyx CreditAttribution: willzyx commentedComment #7
LoMo CreditAttribution: LoMo as a volunteer commentedThe patch no longer even came close to applying, but I think the issue is still valid. I've taken the liberty of attempting a re-roll.
Comment #9
Chi CreditAttribution: Chi commentedThe patch works for me.
I am not sure if this should be included here. This issue is just about wrong location of this hook. Since the hook implementation needs revising I propose we handle this in #2925477: Revise node_views_analyze message.
Comment #10
xjmThanks for working on this!
This issue is a bugfix, so it does need test coverage that proves the bug is fixed. We should add a test that fails against HEAD and passes when combined with the test that moves the hook implementation. Test coverage is a core gate, so we don't postpone it to followup issues even if the state of the test coverage in HEAD is not great.
So, setting "Needs work" to add automated test coverage. Thanks!
Comment #15
g-brodieiWill try to work on this test coverage.
Comment #16
g-brodieiGiving it a try on my first test coverage with #7patch together.
I'm not sure if the asserting method for analyze message is the best approach, if there are any better suggestion, I am all ears!
Setting to needs review.
Comment #17
g-brodieiComment #18
g-brodieiadding bug smash initiative tag
Comment #19
Lendude@g-brodiei nice! Great first effort!
Unused use
This should explain what the test tests, not reference why it was added. 'Tests node_views_analyze().' should be fine.
Lots of trailing white space in the test, that needs to go.
this should be protected
on 9.1 this needs :void
Why are we creating nodes? Is that needed to analyse the View?
Needs a docblock to describe that is being tested
This doesn't do anything, we can take it out
No need to explain this, that is what assertions do (and we don't use /** comments only //)
If the method has a docblock pointing to this, there is no need to mention it here
Comment #20
LendudeOh and please add a test-only patch (with only the test, not the fix) so we can see that the fix actually works.
Comment #21
g-brodiei@Lendude, thank you for reviewing! Submitting a test to fail patch and fixed patch with suggestions.
For the suggestion, there is one I didn't change.
4. I can't run test if $module was set to protected, shown on the error message returned, so remaining as public.
Also removed useless override of function setUp() since there isn't any node needed to be created.
Comment #22
g-brodieiAdd interdiff for review.
Comment #24
g-brodieiSetting back to needs review, the failing test was meant to fail as the patch wasn't combined.
Comment #25
longwaveThis is looking pretty good, thanks for working on it. The $modules property changed from public to protected in 9.0.0. Patches should be produced for the latest version first and then backported if necessary, so bumping this to 9.1.x.
This can just be
In Drupal 9 this needs to be protected, please see https://www.drupal.org/node/2909426
inheritDoc -> inheritdoc
(annoyingly, the PHPStorm autocomplete gets this wrong for Drupal!)
Comment #26
Vidushi Mehta CreditAttribution: Vidushi Mehta at gai Technologies Pvt Ltd commentedAdded a patch with the above mentioned changes by #25.
Comment #27
g-brodieiThank you Longwave for reviewing and Vidushi Mehta for creating the patch for 9.1!
Going to set this to RTBC!!
Comment #28
catchI don't think we should be recommending panels here - can we at least change the message to recommend layout builder? I know that introduces a bit of a conflict with #2925477: Revise node_views_analyze message.
Comment #29
pameeela CreditAttribution: pameeela commentedUpdated patch and interdiff.
Comment #30
longwaveSorry to nitpick but in the module list this is called Layout Builder, I think we should follow the same capitalisation?
Comment #31
pameeela CreditAttribution: pameeela commentedI wondered about that but panels was lowercase so I followed that convention. Easy to change. Patch attached with title case, the committer can choose which one :)
Comment #32
jonathanshawComment #33
g-brodieiWow, the progress moved so fast on this one today! I forgot to reload the page and went generating patches after work just then, and it's done already when I reloaded the page LoL. AWESOME!!!!
Comment #34
larowlanAdding review credits
Comment #36
larowlanFixed on commit:
Committed db13a84 and pushed to 9.1.x. Thanks!
Moving to 9.0.x for a possible backport once freeze is over.
Setup an 8.9 test run
Sidenote: this was my 1000th commit to Drupal core 🎉
Comment #37
larowlanComment #38
jonathanshawI believe this needs rerolled and working versions for both 8.9 and 9.0
Comment #39
ayushmishra206 CreditAttribution: ayushmishra206 at OpenSense Labs commentedRerolled for both 8.9 and 9.0. Please Review.
Comment #40
ayushmishra206 CreditAttribution: ayushmishra206 at OpenSense Labs commentedComment #42
g-brodieiThanks for helping on rerolling ayushmishra206!
as mentioned here by xjm 112.
should be made public for 8.9, and protected for 9.
Would love another set of eye to review too!
Comment #43
g-brodieiReroll for 8.9.x, add interdiff for 39-43
Comment #44
g-brodieiTried rerolling #31 patch for 9.1.x following the guide on reroll patch, no conflicts after rebasing on step 9, so I requested a retest on the #31 patch against 9.1.x.
Comment #45
jonathanshawComment #48
larowlanBackported 186b0a3 and pushed to 9.0.x. Thanks!
Fixed on commit
Backported to 8.9.x as well.