Twig API
Class

Twig_Extension_Staging

class Twig_Extension_Staging extends Twig_Extension

Internal class.

This class is used by Twig_Environment as a staging area and must not be used directly.

Methods

initRuntime(Twig_Environment $environment)

Initializes the runtime environment.

from Twig_Extension
array getTokenParsers()

Returns the token parser instances to add to the existing list.

array getNodeVisitors()

Returns the node visitor instances to add to the existing list.

array getFilters()

Returns a list of filters to add to the existing list.

array getTests()

Returns a list of tests to add to the existing list.

array getFunctions()

Returns a list of functions to add to the existing list.

array getOperators()

Returns a list of operators to add to the existing list.

from Twig_Extension
array getGlobals()

Returns a list of global variables to add to the existing list.

addFunction($name, $function)

addFilter($name, $filter)

addNodeVisitor(Twig_NodeVisitorInterface $visitor)

addTokenParser(Twig_TokenParserInterface $parser)

addGlobal($name, $value)

addTest($name, $test)

string getName()

Returns the name of the extension.

Details

in Twig_Extension at line 20
public initRuntime(Twig_Environment $environment)

Initializes the runtime environment.

This is where you can load some file that contains filter functions for instance.

Parameters

Twig_Environment $environment The current Twig_Environment instance

at line 75
public array getTokenParsers()

Returns the token parser instances to add to the existing list.

Return Value

array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances

at line 62
public array getNodeVisitors()

Returns the node visitor instances to add to the existing list.

Return Value

array An array of Twig_NodeVisitorInterface instances

at line 49
public array getFilters()

Returns a list of filters to add to the existing list.

Return Value

array An array of filters

at line 101
public array getTests()

Returns a list of tests to add to the existing list.

Return Value

array An array of tests

at line 36
public array getFunctions()

Returns a list of functions to add to the existing list.

Return Value

array An array of functions

in Twig_Extension at line 79
public array getOperators()

Returns a list of operators to add to the existing list.

Return Value

array An array of operators

at line 88
public array getGlobals()

Returns a list of global variables to add to the existing list.

Return Value

array An array of global variables

at line 28
public addFunction($name, $function)

Parameters

$name
$function

at line 41
public addFilter($name, $filter)

Parameters

$name
$filter

at line 54
public addNodeVisitor(Twig_NodeVisitorInterface $visitor)

Parameters

Twig_NodeVisitorInterface $visitor

at line 67
public addTokenParser(Twig_TokenParserInterface $parser)

Parameters

Twig_TokenParserInterface $parser

at line 80
public addGlobal($name, $value)

Parameters

$name
$value

at line 93
public addTest($name, $test)

Parameters

$name
$test

at line 109
public string getName()

Returns the name of the extension.

Return Value

string The extension name