Commit 1d6b8d85 by Alexander Makarov

twig: ability to specify options

parent bb5962f9
...@@ -25,6 +25,12 @@ class TwigViewRenderer extends ViewRenderer ...@@ -25,6 +25,12 @@ class TwigViewRenderer extends ViewRenderer
public $fileExtension = 'twig'; public $fileExtension = 'twig';
/** /**
* @var array options
* @see http://twig.sensiolabs.org/doc/api.html#environment-options
*/
public $options = array();
/**
* @var \Twig_Environment * @var \Twig_Environment
*/ */
protected $_twig; protected $_twig;
...@@ -34,9 +40,10 @@ class TwigViewRenderer extends ViewRenderer ...@@ -34,9 +40,10 @@ class TwigViewRenderer extends ViewRenderer
\Yii::setAlias('@Twig', $this->twigDir); \Yii::setAlias('@Twig', $this->twigDir);
$loader = new \Twig_Loader_String(); $loader = new \Twig_Loader_String();
$this->_twig = new \Twig_Environment($loader, array(
$this->_twig = new \Twig_Environment($loader, array_merge(array(
'cache' => \Yii::getAlias($this->cacheDir), 'cache' => \Yii::getAlias($this->cacheDir),
)); ), $this->options));
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment