Browse Source

twig: ability to specify options

tags/2.0.0-beta
Alexander Makarov 12 years ago
parent
commit
1d6b8d856c
  1. 11
      framework/renderers/TwigViewRenderer.php

11
framework/renderers/TwigViewRenderer.php

@ -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
\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));
} }
/** /**

Loading…
Cancel
Save