Twig view renderer
author | Leonid Svyatov leonid@svyatov.ru |
---|---|
author | Alexander Makarov sam@rmcreative.ru |
link | |
link | |
version | 1.1.15 |
package | Default |
_addCustom(string $classType,array $elements)
Throws |
|
---|
string
'Function' or 'Filter'
array
Parameters of elements to add
addExtensions(array $extensions)
array
@see self::$extensions
addFilters(array $filters)
array
@see self::$filters
addFunctions(array $functions)
array
@see self::$functions
addGlobals(array $globals)
array
@see self::$globals
init()
renderFile(\CBaseController $context,string $sourceFile,mixed $data,boolean $return): mixed
This method is required by \IViewRenderer.
\CBaseController
the controller or widget who is rendering the view file.
string
the view file path
mixed
the data to be passed to the view
boolean
whether the rendering result should be returned
mixed
the rendering result, or null if the rendering result is not needed.
setLexerOptions(array $options)
array
@see self::$lexerOptions
twigPathAlias :string
var | Path alias to Twig |
---|
string
fileExtension :string
var | Twig template files extension |
---|
string
globals :array
var | Objects or static classes Keys of array are names to call in template, values - objects or names of static class as string Example: array('html'=>'CHtml', 'clientScript'=>Yii::app()->clientScript) Than in template: {{ html.link('Login', 'site/login') }} or {{ clientScript.registerCssFile(...) }} |
---|
array
functions :array
var | Custom functions Keys of array are names to call in template, values - names of functions or static methods of some class Example: array('rot13'=>'str_rot13', 'link'=>'CHtml::link') Than in template: {{ rot13('test') }} or {{ link('Login', 'site/login') }} |
---|
array
filters :array
var | Custom filters Keys of array are names to call in template, values - names of functions or static methods of some class Example: array('rot13'=>'str_rot13', 'jsonEncode'=>'CJSON::encode') Then in template: {{ 'test'|rot13 }} or {{ model|jsonEncode }} |
---|
array
extensions :array
var | Custom extensions Example: array('Twig_Extension_Sandbox', 'Twig_Extension_Text') |
---|
array
lexerOptions :array
var | Twig lexer options |
---|---|
see | Example: Smarty-like syntax array( 'tag_comment' => array('{', '}'), 'tag_block' => array('{', '}'), 'tag_variable' => array('{$', '}') ) |
array
_twig :
_paths :