EasyAdminTwigExtension
extends AbstractExtension
in package
implements
GlobalsInterface
Defines the filters and functions used to render the bundle's templates.
Also injects the admin context into Twig global variables as ea
in order
to be used by admin templates.
Tags
Table of Contents
Interfaces
- GlobalsInterface
- Enables usage of the deprecated Twig\Extension\AbstractExtension::getGlobals() method.
Properties
- $adminContextProvider : AdminContextProvider
- $csrfTokenManager : CsrfTokenManagerInterface|null
- $serviceLocator : ServiceLocator
Methods
- __construct() : mixed
- applyFilterIfExists() : mixed
- callFunctionIfExists() : mixed
- createFieldLayout() : FieldLayoutDto
- fileSize() : string
- flattenArray() : array<string|int, mixed>
- Transforms ['a' => 'foo', 'b' => ['c' => ['d' => 7]]] into ['a' => 'foo', 'b[c][d]' => 7] It's useful to submit nested arrays (e.g. query string parameters) as form fields.
- getAdminUrlGenerator() : AdminUrlGenerator
- getFilters() : array<string|int, TwigFilter>
- Returns a list of filters to add to the existing list.
- getFunctions() : array<string|int, TwigFunction>
- Returns a list of functions to add to the existing list.
- getGlobals() : array<string, mixed>
- getNodeVisitors() : array<string|int, NodeVisitorInterface>
- Returns the node visitor instances to add to the existing list.
- getOperators() : array<string|int, array<string|int, mixed>>
- Returns a list of operators to add to the existing list.
- getTests() : array<string|int, TwigTest>
- Returns a list of tests to add to the existing list.
- getTokenParsers() : array<string|int, TokenParserInterface>
- Returns the token parser instances to add to the existing list.
- renderCsrfToken() : string
- Needed to avoid errors when calling 'csrf_token()' in Twig templates of applications that disabled CSRF protection.
- representAsString() : string
Properties
$adminContextProvider
private
AdminContextProvider
$adminContextProvider
$csrfTokenManager
private
CsrfTokenManagerInterface|null
$csrfTokenManager
$serviceLocator
private
ServiceLocator
$serviceLocator
Methods
__construct()
public
__construct(ServiceLocator $serviceLocator, AdminContextProvider $adminContextProvider, CsrfTokenManagerInterface|null $csrfTokenManager) : mixed
Parameters
- $serviceLocator : ServiceLocator
- $adminContextProvider : AdminContextProvider
- $csrfTokenManager : CsrfTokenManagerInterface|null
applyFilterIfExists()
public
applyFilterIfExists(Environment $environment, mixed $value, string $filterName, mixed ...$filterArguments) : mixed
Parameters
- $environment : Environment
- $value : mixed
- $filterName : string
- $filterArguments : mixed
callFunctionIfExists()
public
callFunctionIfExists(Environment $environment, string $functionName, mixed ...$functionArguments) : mixed
Parameters
- $environment : Environment
- $functionName : string
- $functionArguments : mixed
createFieldLayout()
public
createFieldLayout(FieldCollection|null $fieldDtos) : FieldLayoutDto
Parameters
- $fieldDtos : FieldCollection|null
Return values
FieldLayoutDtofileSize()
public
fileSize(int $bytes) : string
Parameters
- $bytes : int
Return values
stringflattenArray()
Transforms ['a' => 'foo', 'b' => ['c' => ['d' => 7]]] into ['a' => 'foo', 'b[c][d]' => 7] It's useful to submit nested arrays (e.g. query string parameters) as form fields.
public
flattenArray(mixed $array[, mixed $parentKey = null ]) : array<string|int, mixed>
Parameters
- $array : mixed
- $parentKey : mixed = null
Return values
array<string|int, mixed>getAdminUrlGenerator()
public
getAdminUrlGenerator([array<string|int, mixed> $queryParameters = [] ]) : AdminUrlGenerator
Parameters
- $queryParameters : array<string|int, mixed> = []
Return values
AdminUrlGeneratorgetFilters()
Returns a list of filters to add to the existing list.
public
getFilters() : array<string|int, TwigFilter>
Return values
array<string|int, TwigFilter>getFunctions()
Returns a list of functions to add to the existing list.
public
getFunctions() : array<string|int, TwigFunction>
Return values
array<string|int, TwigFunction>getGlobals()
public
getGlobals() : array<string, mixed>
Return values
array<string, mixed>getNodeVisitors()
Returns the node visitor instances to add to the existing list.
public
getNodeVisitors() : array<string|int, NodeVisitorInterface>
Return values
array<string|int, NodeVisitorInterface>getOperators()
Returns a list of operators to add to the existing list.
public
getOperators() : array<string|int, array<string|int, mixed>>
Return values
array<string|int, array<string|int, mixed>> —First array of unary operators, second array of binary operators
getTests()
Returns a list of tests to add to the existing list.
public
getTests() : array<string|int, TwigTest>
Return values
array<string|int, TwigTest>getTokenParsers()
Returns the token parser instances to add to the existing list.
public
getTokenParsers() : array<string|int, TokenParserInterface>
Return values
array<string|int, TokenParserInterface>renderCsrfToken()
Needed to avoid errors when calling 'csrf_token()' in Twig templates of applications that disabled CSRF protection.
public
renderCsrfToken(string $tokenId) : string
Parameters
- $tokenId : string
Return values
stringrepresentAsString()
public
representAsString(mixed $value) : string
Parameters
- $value : mixed