From c352e405189d92f2e02ba29c5b2ba69cc70e80f9 Mon Sep 17 00:00:00 2001 From: Hugo Sales Date: Thu, 28 Oct 2021 14:29:34 +0100 Subject: [PATCH] [CORE][Controller] Allow plugins to override the Twig templates --- src/Core/Controller.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Core/Controller.php b/src/Core/Controller.php index 809dcb0413..5b53ed885f 100644 --- a/src/Core/Controller.php +++ b/src/Core/Controller.php @@ -122,6 +122,7 @@ abstract class Controller extends AbstractController implements EventSubscriberI $this->vars = array_merge_recursive($this->vars, $response); $template = \array_key_exists('_template', $this->vars) ? $this->vars['_template'] : null; + Event::handle('OverrideTemplate', [$this->vars, &$template]); // Allow plugins to replace the template used for anything unset($this->vars['_template'], $response['_template']); // Respond in the most preferred acceptable content type