From a0f3e844324092133c97c8695a7957bc32df89e7 Mon Sep 17 00:00:00 2001 From: Yasen Pramatarov Date: Mon, 16 Jun 2025 12:22:26 +0300 Subject: [PATCH] Fixes theme helper to have config array always available --- app/helpers/theme.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/helpers/theme.php b/app/helpers/theme.php index 2ea227d..884b0c2 100644 --- a/app/helpers/theme.php +++ b/app/helpers/theme.php @@ -193,14 +193,19 @@ class Theme */ public static function include($template) { - $themeName = self::getCurrentThemeName(); - $config = self::getConfig(); + global $config; + $config = $config ?? []; + + $themeConfig = self::getConfig(); + $themeName = self::getCurrentThemeName(); - // Import all global variables into local scope // We need this here, otherwise because this helper // between index and the views breaks the session vars extract($GLOBALS, EXTR_SKIP | EXTR_REFS); + // Ensure config is always available in templates + $config = array_merge($config, $themeConfig); + // For non-default themes, look in the theme directory first if ($themeName !== 'default') { $themePath = $config['paths']['themes'] . '/' . $themeName . '/views/' . $template . '.php';