diff --git a/CHANGELOG.md b/CHANGELOG.md index f4d2f34d7..436973556 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# v1.7.40 +## 02/dd/2023 + +1. [](#bugfix) + * Fix for overzealous modular page template rendering fix in 1.7.39 causing Feed plugin to break [#3689](https://github.com/getgrav/grav/issues/3689) + # v1.7.39.2 ## 02/20/2023 diff --git a/system/src/Grav/Common/Twig/Twig.php b/system/src/Grav/Common/Twig/Twig.php index 1d2beb953..e1709d104 100644 --- a/system/src/Grav/Common/Twig/Twig.php +++ b/system/src/Grav/Common/Twig/Twig.php @@ -493,13 +493,19 @@ class Twig /** * Simple helper method to get the twig template if it has already been set, else return * the one being passed in + * NOTE: Modular pages that are injected should not use this pre-set template as it's usually set at the page level * - * @param string $template the template name + * @param PageInterface $page the template name * @return string the template name */ - public function template($template) + public function template(PageInterface $page, string $extension): string { - return $this->template ?? $template; + $template = $page->template() . $extension; + if ($page->isModule()) { + return $template; + } else { + return $this->template ?? $template; + } } /** @@ -513,7 +519,8 @@ class Twig $default = $page->isModule() ? 'modular/default' : 'default'; $extension = $format ?: $page->templateFormat(); $twig_extension = $extension ? '.'. $extension .TWIG_EXT : TEMPLATE_EXT; - $template_file = $template . $twig_extension; +// $template_file = $template . $twig_extension; + $template_file = $this->template($page, $twig_extension); // TODO: no longer needed in Twig 3. /** @var ExistsLoaderInterface $loader */