Twig API
Interface

Twig_ExtensionInterface

interface Twig_ExtensionInterface

Interface implemented by extension classes.

Methods

initRuntime(Twig_Environment $environment)

Initializes the runtime environment.

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.

array getGlobals()

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

string getName()

Returns the name of the extension.

Details

at line 26
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 33
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 40
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 47
public array getFilters()

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

Return Value

array An array of filters

at line 54
public array getTests()

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

Return Value

array An array of tests

at line 61
public array getFunctions()

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

Return Value

array An array of functions

at line 68
public array getOperators()

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

Return Value

array An array of operators

at line 75
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 82
public string getName()

Returns the name of the extension.

Return Value

string The extension name