mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-30 14:37:20 +08:00
twig: ability to specify options
This commit is contained in:
@@ -24,6 +24,12 @@ class TwigViewRenderer extends ViewRenderer
|
|||||||
public $cacheDir = '@app/runtime/Twig/cache';
|
public $cacheDir = '@app/runtime/Twig/cache';
|
||||||
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
|
||||||
*/
|
*/
|
||||||
@@ -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));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user