diff --git a/src/View/View.php b/src/View/View.php index c7636be66e2..a82a92e4415 100644 --- a/src/View/View.php +++ b/src/View/View.php @@ -493,11 +493,10 @@ public function renderLayout($content, $layout = null) return $this->Blocks->get('content'); } - if (empty($content)) { - $content = $this->Blocks->get('content'); - } else { - $this->Blocks->set('content', $content); + if (!empty($content)) { + $this->Blocks->set('content', $content); } + $this->dispatchEvent('View.beforeLayout', [$layoutFileName]); $title = $this->Blocks->get('title');