From 6cce90f2de4a6f7961638f7e61d169817170e369 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Goetz?= Date: Thu, 5 Sep 2019 23:18:51 +0200 Subject: [PATCH] Allow to specify template to use in attributes --- libs/Format/HTML/ContentPage.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libs/Format/HTML/ContentPage.php b/libs/Format/HTML/ContentPage.php index cb3bf3a..5ad705b 100644 --- a/libs/Format/HTML/ContentPage.php +++ b/libs/Format/HTML/ContentPage.php @@ -104,6 +104,15 @@ class ContentPage extends \Todaymade\Daux\Format\Base\ContentPage $context = ['page' => $page, 'params' => $params]; - return $this->templateRenderer->render($this->isLanding() ? 'theme::home' : 'theme::content', $context); + $template = "theme::content"; + if ($this->isLanding()) { + $template = "theme::home"; + } + + if (array_key_exists('template', $page['attributes'])) { + $template = "theme::" . $page['attributes']['template']; + } + + return $this->templateRenderer->render($template, $context); } }