Browse Source

Pico::loadConfig(): Improve Twig config parsing

Thanks @refeaime for reporting this
Daniel Rudolf 8 years ago
parent
commit
13b167e23a
1 changed files with 8 additions and 1 deletions
  1. 8 1
      lib/Pico.php

+ 8 - 1
lib/Pico.php

@@ -465,7 +465,7 @@ class Pico
             'rewrite_url' => null,
             'theme' => 'default',
             'date_format' => '%D %T',
-            'twig_config' => array('cache' => false, 'autoescape' => false, 'debug' => false),
+            'twig_config' => null,
             'pages_order_by' => 'alpha',
             'pages_order' => 'asc',
             'content_dir' => null,
@@ -486,6 +486,13 @@ class Pico
             $this->config['rewrite_url'] = $this->isUrlRewritingEnabled();
         }
 
+        $defaultTwigConfig = array('cache' => false, 'autoescape' => false, 'debug' => false);
+        if (!is_array($this->config['twig_config'])) {
+            $this->config['twig_config'] = $defaultTwigConfig;
+        } else {
+            $this->config['twig_config'] += $defaultTwigConfig;
+        }
+
         if (empty($this->config['content_dir'])) {
             // try to guess the content directory
             if (is_dir($this->getRootDir() . 'content')) {