Skip to content

Commit 60e8fa0

Browse files
committed
Twig Environment cache option is now configurable
1 parent 907ebb5 commit 60e8fa0

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

libraries/Twig.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616

1717
class Twig
1818
{
19-
private $config = [
20-
'paths' => [VIEWPATH],
21-
];
19+
private $config = [];
2220

2321
private $functions_asis = [
2422
'base_url', 'site_url'
@@ -44,6 +42,12 @@ class Twig
4442

4543
public function __construct($params = [])
4644
{
45+
// default config
46+
$this->config = [
47+
'paths' => [VIEWPATH],
48+
'cache' => APPPATH . '/cache/twig',
49+
];
50+
4751
$this->config = array_merge($this->config, $params);
4852
}
4953

@@ -76,7 +80,7 @@ public function createTwig()
7680
}
7781

7882
$twig = new \Twig_Environment($this->loader, [
79-
'cache' => APPPATH . '/cache/twig',
83+
'cache' => $this->config['cache'],
8084
'debug' => $debug,
8185
'autoescape' => TRUE,
8286
]);

0 commit comments

Comments
 (0)