From 631797476655ce779ad9a6c647fdff29d3f7cac2 Mon Sep 17 00:00:00 2001 From: Tim van Dijen <tim.dijen@minbzk.nl> Date: Wed, 6 Apr 2022 14:23:38 +0200 Subject: [PATCH] Make getContents public to be able to use Twig templates for other things then web pages (i.e. mail templates) --- lib/SimpleSAML/XHTML/Template.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/SimpleSAML/XHTML/Template.php b/lib/SimpleSAML/XHTML/Template.php index 9df0554f7..1bfd2e5af 100644 --- a/lib/SimpleSAML/XHTML/Template.php +++ b/lib/SimpleSAML/XHTML/Template.php @@ -540,12 +540,14 @@ class Template extends Response * @return string The HTML rendered by this template, as a string. * @throws \Exception if the template cannot be found. */ - protected function getContents(): string + public function getContents(): string { $this->twigDefaultContext(); + if ($this->controller) { $this->controller->display($this->data); } + try { return $this->twig->render($this->twig_template, $this->data); } catch (RuntimeError $e) { -- GitLab