diff --git a/CHANGELOG.md b/CHANGELOG.md index f4d2f34d7..2932c3d6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# v1.7.39.3 +## 02/21/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/defines.php b/system/defines.php index e26f1c995..b343f0526 100644 --- a/system/defines.php +++ b/system/defines.php @@ -9,7 +9,7 @@ // Some standard defines define('GRAV', true); -define('GRAV_VERSION', '1.7.39.2'); +define('GRAV_VERSION', '1.7.39.3'); define('GRAV_SCHEMA', '1.7.0_2020-11-20_1'); define('GRAV_TESTING', false); diff --git a/system/src/Grav/Common/Twig/Twig.php b/system/src/Grav/Common/Twig/Twig.php index 1d2beb953..a52bb6de8 100644 --- a/system/src/Grav/Common/Twig/Twig.php +++ b/system/src/Grav/Common/Twig/Twig.php @@ -493,13 +493,19 @@ public function prependPath($template_path, $namespace = '__main__') /** * 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 * @return string the template name */ - public function template($template) + public function template(string $template): string { - return $this->template ?? $template; + if (isset($this->template)) { + $template = $this->template; + unset($this->template); + } + + return $template; } /** @@ -513,7 +519,7 @@ public function getPageTwigTemplate($page, &$format = null) $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 = $this->template($template . $twig_extension); // TODO: no longer needed in Twig 3. /** @var ExistsLoaderInterface $loader */