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.
If view display have header / footer with other this view displays, calculateDependencies() method adds to dependencies this view.
Comment | File | Size | Author |
---|---|---|---|
#13 | recursion_calculate_dependencies.patch | 3.44 KB | devpreview |
Comments
Comment #1
dawehnerGood catch!!! Do you think we should write a test here?
Comment #2
devpreview CreditAttribution: devpreview commentedI tried to write the tests but I don't understand how to write them.
Sorry.
Comment #4
dawehnerSo what you would do is to write some code which calls out to
This itself might try to load the view itself, see
$this->viewStorage->load($view_id)
In order for that to work, you have to mock the behaviour of the entity storage:
Feel free to ping me in IRC.
Comment #5
devpreview CreditAttribution: devpreview commentedPatch with tests.
Thanks for help from IRC!
Comment #6
devpreview CreditAttribution: devpreview commentedComment #7
dawehnerAwesome work
It would be great to add a one-line documentation explaining why we need this check here.
Comment #8
devpreview CreditAttribution: devpreview commentedSorry, I do not speak English.
This comment will be correct?
Comment #9
dawehnerMaybe try something like: // Ensure to not call the current view, as it would result into a infinite recursion.
Comment #10
devpreview CreditAttribution: devpreview commentedThen
"exists insert view id" for old "if ($view_id)" condition.
Comment #11
devpreview CreditAttribution: devpreview commentedUpdated one-line documentation
Comment #12
dawehnerSorry for the endless nitpicking here ... i think its pointless to describe what the code is doing but rather we should describe why (which is doing the second part of the sentence).
I would vote for: "Don't call the current view, as it would result into an infinite recursion."
Comment #13
devpreview CreditAttribution: devpreview commentedThank you for your help!
I don't think it's nitpicking since it makes the code better :)
Comment #14
dawehnerThank you!
Comment #15
alexpottGreat catch and nice patch. This issue is a normal bug fix, and doesn't include any disruptive changes, so it is allowed per https://www.drupal.org/core/beta-changes. Committed 0943b23 and pushed to 8.0.x. Thanks!