Fixes theme helper to have config array always available
parent
c9490cf149
commit
a0f3e84432
|
@ -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';
|
||||
|
|
Loading…
Reference in New Issue