class extension extends AbstractExtension

Properties

protected context $context
protected environment $environment
protected language $language

Methods

__construct(context $context, environment $environment, language $language)

Constructor

string
getName()

Get the name of this extension

TokenParserInterface[]
getTokenParsers()

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

TwigFilter[]
getFilters()

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

TwigFunction[]
getFunctions()

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

array[]
getOperators()

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

mixed
loop_subset(Environment $env, mixed $item, int $start, int $end = null, bool $preserveKeys = false)

Grabs a subset of a loop

string
lang()

Get output for a language variable (L_FOO, LA_FOO)

bool
lang_defined($key)

Check if a language variable exists

string
lang_js()

Get output for language variable in JS code

array|string
lang_raw(string $key)

Get raw value associated with lang key

Details

at line 36
__construct(context $context, environment $environment, language $language)

Constructor

Parameters

context $context
environment $environment
language $language

at line 48
string getName()

Get the name of this extension

Return Value

string

at line 58
TokenParserInterface[] getTokenParsers()

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

Return Value

TokenParserInterface[]

An array of \Twig\TokenParser\AbstractTokenParser instances

at line 74
TwigFilter[] getFilters()

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

Return Value

TwigFilter[]

An array of filters

at line 90
TwigFunction[] getFunctions()

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

Return Value

TwigFunction[]

An array of global functions

at line 107
array[] getOperators()

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

Return Value

array[]

An array of operators

at line 150
mixed loop_subset(Environment $env, mixed $item, int $start, int $end = null, bool $preserveKeys = false)

Grabs a subset of a loop

Parameters

Environment $env

A Twig\Environment instance

mixed $item

A variable

int $start

Start of the subset

int $end

End of the subset

bool $preserveKeys

Whether to preserve key or not (when the input is an array)

Return Value

mixed

The sliced variable

at line 179
string lang()

Get output for a language variable (L_FOO, LA_FOO)

This function checks to see if the language var was outputted to $context (e.g. in the ACP, L_TITLE) If not, we return the result of $user->lang()

Return Value

string

at line 202
bool lang_defined($key)

Check if a language variable exists

Parameters

$key

Return Value

bool

at line 212
string lang_js()

Get output for language variable in JS code

Return Value

string

Exceptions

RuntimeError

at line 226
array|string lang_raw(string $key)

Get raw value associated with lang key

Parameters

string $key

Return Value

array|string

Raw value associated with lang key