Documentation

TwigFunction
in package

Represents a template function.

Tags
final
author

Fabien Potencier fabien@symfony.com

see
https://twig.symfony.com/doc/templates.html#functions

Table of Contents

$arguments  : mixed
$callable  : mixed
$name  : mixed
$options  : mixed
__construct()  : mixed
Creates a template function.
getAlternative()  : mixed
getArguments()  : mixed
getCallable()  : callable|null
Returns the callable to execute for this function.
getDeprecatedVersion()  : mixed
getName()  : mixed
getNodeClass()  : mixed
getSafe()  : mixed
isDeprecated()  : mixed
isVariadic()  : mixed
needsContext()  : mixed
needsEnvironment()  : mixed
setArguments()  : mixed

Properties

Methods

__construct()

Creates a template function.

public __construct(string $name[, callable|null $callable = null ][, array<string|int, mixed> $options = [] ]) : mixed
Parameters
$name : string

Name of this function

$callable : callable|null = null

A callable implementing the function. If null, you need to overwrite the "node_class" option to customize compilation.

$options : array<string|int, mixed> = []

Options array

Return values
mixed

getAlternative()

public getAlternative() : mixed
Return values
mixed

getArguments()

public getArguments() : mixed
Return values
mixed

getCallable()

Returns the callable to execute for this function.

public getCallable() : callable|null
Return values
callable|null

getDeprecatedVersion()

public getDeprecatedVersion() : mixed
Return values
mixed

getName()

public getName() : mixed
Return values
mixed

getNodeClass()

public getNodeClass() : mixed
Return values
mixed

getSafe()

public getSafe(Node $functionArgs) : mixed
Parameters
$functionArgs : Node
Return values
mixed

isDeprecated()

public isDeprecated() : mixed
Return values
mixed

isVariadic()

public isVariadic() : mixed
Return values
mixed

needsContext()

public needsContext() : mixed
Return values
mixed

needsEnvironment()

public needsEnvironment() : mixed
Return values
mixed

setArguments()

public setArguments(mixed $arguments) : mixed
Parameters
$arguments : mixed
Return values
mixed

Search results