I had implemented hook_views_post_render() in a custom module and I discovered that I received an error when I forced the class in the function declaration.
With freshly cleared caches, and the exception throwing in Renderer.php (ln 485) being commented out, the hook is being passed Drupal\views\Plugin\views\cache\None instead of Drupal\Core\Cache\CacheBackendInterface
function rest_custom_views_post_render(ViewExecutable $view, &$output, CacheBackendInterface $cache) {
}
With Renderer.php in its default state, I get a the following error as an anonymous user:
LogicException: A stray drupal_render() invocation with $is_root_call = TRUE is causing bubbling of attached assets to break. in Drupal\Core\Render\Renderer->doRender() (line 485 of core/lib/Drupal/Core/Render/Renderer.php).
If I remove the class name from the $cache variable, everything works as expected.
function rest_custom_views_post_render(ViewExecutable $view, &$output, $cache) {
}
Beta phase evaluation
| Issue category | Bug, as its broken documentatio. |
|---|---|
| Issue priority | Normal, as its not an often used API |
| Unfrozen changes | Unfrozen because it only changes documentation. |
| Disruption | No discruption |
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | hook_views_post_render-2544922-3.patch | 1.24 KB | borisson_ |
Comments
Comment #1
dawehnerI'm curious, what is inside your hook?
Comment #2
blake.thompson commentedI commented out everything inside the hook and it still threw the error.
Comment #3
borisson_It's actually an instance of
CachePluginBasethat should be expected here, not an instance ofCacheBackendInterface. I changed the documentation to be correct.Comment #4
dawehner+1 Added a beta eval
Comment #5
alexpottToo many caches. Committed 3f8677b and pushed to 8.0.x. Thanks!
Comment #6
borisson_@alexpott: I can't see this commit in http://cgit.drupalcode.org/drupal/log/, did you do git push?
Comment #7
olli commentedComment #8
alexpott