Property |
Type |
Description |
|
$cachePath |
|
the directory or path alias pointing to where Twig cache will be stored. Set to false to disable
templates cache. |
|
$extensions |
|
Custom extensions.
Example: ['Twig_Extension_Sandbox', new \Twig_Extension_Text()] |
|
$filters |
|
Custom filters.
Keys of the array are names to call in template, values are names of functions or static methods of some class.
Example: ['rot13' => 'str_rot13', 'jsonEncode' => '\yii\helpers\Json::encode'].
In the template you can use it like this: {{ 'test'|rot13 }} or {{ model|jsonEncode }}. |
|
$functions |
|
Custom functions.
Keys of the array are names to call in template, values are names of functions or static methods of some class.
Example: ['rot13' => 'str_rot13', 'a' => '\yii\helpers\Html::a'].
In the template you can use it like this: {{ rot13('test') }} or {{ a('Login', 'site/login') | raw }}. |
|
$globals |
|
Objects or static classes.
Keys of the array are names to call in template, values are objects or names of static classes.
Example: ['html' => '\yii\helpers\Html'].
In the template you can use it like this: {{ html.a('Login', 'site/login') | raw }}. |
|
$lexerOptions |
|
Twig lexer options.
Example: Smarty-like syntax:
php
[
'tag_comment' => ['{*', '*}'],
'tag_block' => ['{', '}'],
'tag_variable' => ['{$', '}']
]
|
|
$options |
|
Twig options. |
|
$twig |
|
twig environment object that renders twig templates |
|
$twigFallbackPaths |
|
twig fallback paths |
|
$twigModulesNamespace |
|
twig namespace to use in modules templates |
|
$twigViewsNamespace |
|
twig namespace to use in templates |
|
$twigWidgetsNamespace |
|
twig namespace to use in widgets templates |
|
$uses |
|
namespaces and classes to import.
Example:
php
[
'yii\bootstrap',
'app\assets',
\yii\bootstrap\NavBar::className(),
]
|
|