fix for rendering specific templates fixes #3698

This commit is contained in:
Andy Miller 2023-02-21 09:39:14 -07:00
parent 3e6c719441
commit 72b769aa63
No known key found for this signature in database
GPG Key ID: 9F2CF38AEBDB0AE0
2 changed files with 17 additions and 4 deletions

View File

@ -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

View File

@ -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 */