Class yii\twig\Extension

Inheritanceyii\twig\Extension » Twig_Extension
Source Code https://github.com/yiisoft/yii2-twig/blob/master/Extension.php

Extension provides Yii-specific syntax for Twig templates.

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$aliases array Used class aliases yii\twig\Extension
$namespaces array Used namespaces yii\twig\Extension
$widgets array Used widgets yii\twig\Extension

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Creates new instance yii\twig\Extension
addUses() Adds namespaces and aliases from constructor yii\twig\Extension
beginWidget() Function for *_begin syntax support yii\twig\Extension
call() Calls a method yii\twig\Extension
endWidget() Function for *_end syntax support yii\twig\Extension
getFunctions() yii\twig\Extension
getName() yii\twig\Extension
getNodeVisitors() yii\twig\Extension
path() Generates relative URL yii\twig\Extension
registerAsset() Function for registering an asset yii\twig\Extension
registerAssetBundle() Function for additional syntax of registering asset bundles yii\twig\Extension
resolveAndCall() Resolves a method from widget and asset syntax and calls it yii\twig\Extension
resolveClassName() Resolves class name from widget and asset syntax yii\twig\Extension
setProperty() Sets object property yii\twig\Extension
url() Generates absolute URL yii\twig\Extension
viewHelper() yii\twig\Extension
widget() Function for *_widget syntax support yii\twig\Extension

Property Details

$aliases protected property

Used class aliases

$namespaces protected property

Used namespaces

$widgets protected property

Used widgets

Method Details

__construct() public method

Creates new instance

void __construct( array $uses = [] )
$uses array

Namespaces and classes to use in the template

addUses() public method

Adds namespaces and aliases from constructor

void addUses$args )
$args array

Namespaces and classes to use in the template

beginWidget() public method

Function for *_begin syntax support

mixed beginWidget$widget$config = [] )
$widget string

Widget name

$config array

Widget config

call() public method

Calls a method

mixed call$className$method$arguments null )
$className string

Class name

$method string

Method name

$arguments array
endWidget() public method

Function for *_end syntax support

void endWidget$widget null )
$widget string

Widget name

getFunctions() public method

void getFunctions( )
getName() public method

void getName( )
getNodeVisitors() public method

void getNodeVisitors( )
path() public method

Generates relative URL

string path$path$args = [] )
$path string

The parameter to be used to generate a valid URL

$args array

Arguments

return string

The generated relative URL

registerAsset() public method

Function for registering an asset

{{ use('yii/web/JqueryAsset') }}
{{ register_jquery_asset() }}
mixed registerAsset$context$asset )
$context array

Context information

$asset string

Asset name

registerAssetBundle() public method (available since version 2.0.4)

Function for additional syntax of registering asset bundles

{{ register_asset_bundle('yii/web/JqueryAsset') }}
void registerAssetBundle$context$bundle )
$context array

Context information

$bundle string

Asset bundle class fully qualified name

resolveAndCall() public method

Resolves a method from widget and asset syntax and calls it

mixed resolveAndCall$className$method$arguments null )
$className string

Class name

$method string

Method name

$arguments array
resolveClassName() public method

Resolves class name from widget and asset syntax

string resolveClassName$className )
$className string

Class name

setProperty() public method

Sets object property

void setProperty$object$property$value )
$object stdClass
$property string
$value \yii\twig\mixes
url() public method

Generates absolute URL

string url$path$args = [] )
$path string

The parameter to be used to generate a valid URL

$args array

Arguments

return string

The generated absolute URL

viewHelper() public method

void viewHelper$context$name null )
$context
$name
widget() public method

Function for *_widget syntax support

mixed widget$widget$config = [] )
$widget string

Widget name

$config array

Widget config