Commit fcbca9a4 authored by git's avatar git Committed by lussoluca

Issue #2856218 by tacituseu: hook_views_post_render argument 3 must be an...

Issue #2856218 by tacituseu: hook_views_post_render argument 3 must be an instance of CachePluginBase, boolean given
parent dbe585a3
......@@ -3,6 +3,7 @@
namespace Drupal\webprofiler\Views;
use Drupal\views\ViewExecutable;
use Drupal\views\Views;
use Symfony\Component\HttpFoundation\Response;
/**
......@@ -58,6 +59,7 @@ class TraceableViewExecutable extends ViewExecutable {
return;
}
/** @var \Drupal\views\Plugin\views\exposed_form\ExposedFormPluginInterface $exposed_form */
$exposed_form = $this->display_handler->getPlugin('exposed_form');
$exposed_form->preRender($this->result);
......@@ -70,11 +72,11 @@ class TraceableViewExecutable extends ViewExecutable {
$themes[] = $active_theme->getName();
// Check for already-cached output.
/** @var \Drupal\views\Plugin\views\cache\CachePluginBase $cache */
if (!empty($this->live_preview)) {
$cache = FALSE;
$cache = Views::pluginManager('cache')->createInstance('none');
}
else {
/** @var \Drupal\views\Plugin\views\cache\CachePluginBase $cache */
$cache = $this->display_handler->getPlugin('cache');
}
......@@ -130,9 +132,7 @@ class TraceableViewExecutable extends ViewExecutable {
$exposed_form->postRender($this->display_handler->output);
if ($cache) {
$cache->postRender($this->display_handler->output);
}
$cache->postRender($this->display_handler->output);
// Let modules modify the view output after it is rendered.
$module_handler->invokeAll('views_post_render', [
......@@ -145,7 +145,7 @@ class TraceableViewExecutable extends ViewExecutable {
foreach ($themes as $theme_name) {
$function = $theme_name . '_views_post_render';
if (function_exists($function)) {
$function($this);
$function($this, $this->display_handler->output, $cache);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment