PHP 클래스 yii\twig\ViewRenderer

부터: 2.0
저자: Alexander Makarov ([email protected])
상속: extends yii\base\ViewRenderer
파일 보기 프로젝트 열기: yiisoft/yii2-twig 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$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(), ]

공개 메소드들

메소드 설명
addExtensions ( array $extensions ) Adds custom extensions
addFilters ( array $filters ) Adds custom filters
addFunctions ( array $functions ) Adds custom functions
addGlobals ( array $globals ) Adds global objects or static classes
init ( )
render ( View $view, string $file, array $params ) : string Renders a view file.
setLexerOptions ( array $options ) Sets Twig lexer options to change templates syntax

보호된 메소드들

메소드 설명
addAliases ( Twig_Loader_Filesystem $loader, array $aliases ) Adds aliases
addFallbackPaths ( Twig_Loader_Filesystem $loader, Theme | null $theme ) Adds fallback paths to twig loader

비공개 메소드들

메소드 설명
_addCustom ( string $classType, array $elements ) Adds custom function or filter

메소드 상세

addAliases() 보호된 메소드

Adds aliases
protected addAliases ( Twig_Loader_Filesystem $loader, array $aliases )
$loader Twig_Loader_Filesystem
$aliases array

addExtensions() 공개 메소드

Adds custom extensions
public addExtensions ( array $extensions )
$extensions array @see self::$extensions

addFallbackPaths() 보호된 메소드

Adds fallback paths to twig loader
부터: 2.0.5
protected addFallbackPaths ( Twig_Loader_Filesystem $loader, Theme | null $theme )
$loader Twig_Loader_Filesystem
$theme yii\base\Theme | null

addFilters() 공개 메소드

Adds custom filters
public addFilters ( array $filters )
$filters array @see self::$filters

addFunctions() 공개 메소드

Adds custom functions
public addFunctions ( array $functions )
$functions array @see self::$functions

addGlobals() 공개 메소드

Adds global objects or static classes
public addGlobals ( array $globals )
$globals array @see self::$globals

init() 공개 메소드

public init ( )

render() 공개 메소드

This method is invoked by [[View]] whenever it tries to render a view. Child classes must implement this method to render the given view file.
public render ( View $view, string $file, array $params ) : string
$view yii\base\View the view object used for rendering the file.
$file string the view file.
$params array the parameters to be passed to the view file.
리턴 string the rendering result

setLexerOptions() 공개 메소드

Sets Twig lexer options to change templates syntax
public setLexerOptions ( array $options )
$options array @see self::$lexerOptions

프로퍼티 상세

$cachePath 공개적으로 프로퍼티

the directory or path alias pointing to where Twig cache will be stored. Set to false to disable templates cache.
public $cachePath

$extensions 공개적으로 프로퍼티

Custom extensions. Example: ['Twig_Extension_Sandbox', new \Twig_Extension_Text()]
public $extensions

$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 }}.
public $filters

$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 }}.
public $functions

$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 }}.
public $globals

$lexerOptions 공개적으로 프로퍼티

Twig lexer options. Example: Smarty-like syntax: php [ 'tag_comment' => ['{*', '*}'], 'tag_block' => ['{', '}'], 'tag_variable' => ['{$', '}'] ]
또한 보기: http://twig.sensiolabs.org/doc/recipes.html#customizing-the-syntax
public $lexerOptions

$options 공개적으로 프로퍼티

Twig options.
또한 보기: http://twig.sensiolabs.org/doc/api.html#environment-options
public $options

$twig 공개적으로 프로퍼티

twig environment object that renders twig templates
public $twig

$twigFallbackPaths 공개적으로 프로퍼티

twig fallback paths
부터: 2.0.5
public $twigFallbackPaths

$twigModulesNamespace 공개적으로 프로퍼티

twig namespace to use in modules templates
부터: 2.0.5
public $twigModulesNamespace

$twigViewsNamespace 공개적으로 프로퍼티

twig namespace to use in templates
부터: 2.0.5
public $twigViewsNamespace

$twigWidgetsNamespace 공개적으로 프로퍼티

twig namespace to use in widgets templates
부터: 2.0.5
public $twigWidgetsNamespace

$uses 공개적으로 프로퍼티

namespaces and classes to import. Example: php [ 'yii\bootstrap', 'app\assets', \yii\bootstrap\NavBar::className(), ]
public $uses