From d2573c5df55712b22a1faf98d4dbe3e249f41bf2 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Sun, 20 Oct 2019 19:17:42 +0200 Subject: [PATCH] Fix $this->config['twig_config'] handling in Pico::loadTheme() --- lib/Pico.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/Pico.php b/lib/Pico.php index b5e3278..be71755 100644 --- a/lib/Pico.php +++ b/lib/Pico.php @@ -1083,14 +1083,9 @@ class Pico // load theme config from pico-theme.yml $themeConfigFile = $this->getThemesDir() . $this->getTheme() . '/pico-theme.yml'; if (is_file($themeConfigFile)) { - $yamlParser = $this->getYamlParser(); - $loadConfigClosure = function ($configFile) use ($yamlParser) { - $yaml = file_get_contents($configFile); - $config = $yamlParser->parse($yaml); - return is_array($config) ? $config : array(); - }; - - $themeConfig = $loadConfigClosure($themeConfigFile); + $themeConfigYaml = file_get_contents($themeConfigFile); + $themeConfig = $this->getYamlParser()->parse($themeConfigYaml); + $themeConfig = is_array($themeConfig) ? $themeConfig : array(); } $themeConfig += array( @@ -1119,6 +1114,7 @@ class Pico unset($themeConfig['twig_config']); $defaultTwigConfig = array('debug' => null, 'cache' => false, 'auto_reload' => null); + $this->config['twig_config'] = is_array($this->config['twig_config']) ? $this->config['twig_config'] : array(); $this->config['twig_config'] = array_merge($defaultTwigConfig, $themeTwigConfig, $this->config['twig_config']); if ($this->config['twig_config']['autoescape'] === true) {