check explicitly for template existence and try to use default theme as fallback; fixes #1071

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2023-01-10 16:53:36 +01:00
parent cc6d8d5f8b
commit c420196e73

View File

@@ -260,8 +260,17 @@ class UI
*/
public static function twigBuffer($name, array $context = [])
{
$template_file = self::getTheme() . '/' . $name;
if (!file_exists(Froxlor::getInstallDir() . '/templates/' . $template_file)) {
PhpHelper::phpErrHandler(E_USER_WARNING, "Template '" . $template_file . "' could not be found, trying fallback theme", __FILE__, __LINE__);
$template_file = self::$default_theme . '/'. $name;
if (!file_exists(Froxlor::getInstallDir() . '/templates/' . $template_file)) {
PhpHelper::phpErrHandler(E_USER_ERROR, "Unknown template '" . $template_file . "'", __FILE__, __LINE__);
}
}
self::$twigbuf[] = [
self::getTheme() . '/' . $name => $context
$template_file => $context
];
}