diff --git a/_include/src/Template/HtmlTemplateProvider.php b/_include/src/Template/HtmlTemplateProvider.php
index 657aee6e..935c8447 100644
--- a/_include/src/Template/HtmlTemplateProvider.php
+++ b/_include/src/Template/HtmlTemplateProvider.php
@@ -137,23 +137,21 @@ static function ($matches) use ($requestUri) {
private function getTemplateFullFilename(?string $extraDir, string $cleanTemplateId): string
{
- if ($extraDir !== null) {
- $templatePathInExtension = $this->rootDir . '_extensions/' . $extraDir . '/templates/' . $cleanTemplateId;
- if (file_exists($templatePathInExtension)) {
- return $templatePathInExtension;
- }
+ $pathInStyles = $this->rootDir . '_styles/' . $this->styleName . '/templates/' . $cleanTemplateId;
+ if (file_exists($pathInStyles)) {
+ return $pathInStyles;
}
- $templatePathInStyles = $this->rootDir . '_styles/' . $this->styleName . '/templates/' . $cleanTemplateId;
- if (file_exists($templatePathInStyles)) {
- return $templatePathInStyles;
+ if ($extraDir !== null) {
+ $path = $this->rootDir . '_extensions/' . $extraDir . '/templates/' . $cleanTemplateId;
+ } else {
+ $path = $this->rootDir . '_include/templates/' . $cleanTemplateId;
}
- $templateDefaultPath = $this->rootDir . '_include/templates/' . $cleanTemplateId;
- if (file_exists($templateDefaultPath)) {
- return $templateDefaultPath;
+ if (file_exists($path)) {
+ return $path;
}
- throw new \RuntimeException(sprintf(\Lang::get('Template not found'), $templateDefaultPath));
+ throw new \RuntimeException(sprintf(\Lang::get('Template not found'), $path));
}
}