Skip to content

Commit

Permalink
Add twigAutoescape config setting
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksip committed Jan 7, 2016
1 parent 3e28821 commit 4fcf3c1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion composer.json
Expand Up @@ -35,6 +35,7 @@
"lineageMatchKey": 2,
"patternExtension": "twig",
"twigDebug": false,
"twigAutoescape": "html",
"twigDefaultDateFormat": "",
"twigDefaultIntervalFormat": "",
"twigMacroExt": "macro.twig",
Expand All @@ -45,4 +46,4 @@
}
}
}
}
}
3 changes: 2 additions & 1 deletion src/PatternLab/PatternEngine/Twig/Loaders/PatternLoader.php
Expand Up @@ -28,6 +28,7 @@ public function __construct($options = array()) {

// set-up default vars
$twigDebug = Config::getOption("twigDebug");
$twigAutoescape = Config::getOption("twigAutoescape");

// set-up the loader list
$loaders = array();
Expand Down Expand Up @@ -56,7 +57,7 @@ public function __construct($options = array()) {

// set-up Twig
$twigLoader = new \Twig_Loader_Chain($loaders);
$this->instance = new \Twig_Environment($twigLoader, array("debug" => $twigDebug));
$this->instance = new \Twig_Environment($twigLoader, array("debug" => $twigDebug, "autoescape" => $twigAutoescape));

// customize Twig
$this->instance = TwigUtil::loadFilters($this->instance);
Expand Down

0 comments on commit 4fcf3c1

Please sign in to comment.