ETwigViewRenderer

Extends\CApplicationComponent Implements\IViewRenderer

Twig view renderer

author

Leonid Svyatov leonid@svyatov.ru

author

Alexander Makarov sam@rmcreative.ru

link

http://github.com/yiiext/twig-renderer

link

http://twig.sensiolabs.org

version 1.1.15
package

Default

Methods

Adds custom function or filter

_addCustom(string $classType,array $elements)
Throws
\CException

Arguments

$classType

string

'Function' or 'Filter'

$elements

array

Parameters of elements to add

Adds custom extensions

addExtensions(array $extensions)

Arguments

$extensions

array

@see self::$extensions

Adds custom filters

addFilters(array $filters)

Arguments

$filters

array

@see self::$filters

Adds custom functions

addFunctions(array $functions)

Arguments

$functions

array

@see self::$functions

Adds global objects or static classes

addGlobals(array $globals)

Arguments

$globals

array

@see self::$globals

Returns Twig object

getTwig(): \Twig_Environment

init

init()

Renders a view file.

renderFile(\CBaseController $context,string $sourceFile,mixed $data,boolean $return): mixed

This method is required by \IViewRenderer.

Arguments

$context

\CBaseController

the controller or widget who is rendering the view file.

$sourceFile

string

the view file path

$data

mixed

the data to be passed to the view

$return

boolean

whether the rendering result should be returned

Response

mixed

the rendering result, or null if the rendering result is not needed.

Sets Twig lexer options to change templates syntax

setLexerOptions(array $options)

Arguments

$options

array

@see self::$lexerOptions

Properties

Path alias to Twig

twigPathAlias :string
var

Path alias to Twig

Type(s)

string

Twig template files extension

fileExtension :string
var

Twig template files extension

Type(s)

string

Twig environment options

options :array
var

Twig environment options

see

Type(s)

array

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(...) }}

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(...) }}

Type(s)

array

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') }}

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') }}

Type(s)

array

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 }}

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 }}

Type(s)

array

Custom extensions Example: array('Twig_Extension_Sandbox', 'Twig_Extension_Text')

extensions :array
var

Custom extensions Example: array('Twig_Extension_Sandbox', 'Twig_Extension_Text')

Type(s)

array

Twig lexer options

lexerOptions :array
var

Twig lexer options

see

Example: Smarty-like syntax array( 'tag_comment' => array('{', '}'), 'tag_block' => array('{', '}'), 'tag_variable' => array('{$', '}') )

Type(s)

array

_twig

_twig :

Type(s)

_paths

_paths :

Type(s)