mediatekformation

TemplatingRendererEngine extends AbstractRendererEngine
in package

Default implementation of {@link FormRendererEngineInterface}.

Tags
author

Bernhard Schussek bschussek@gmail.com

deprecated

since version 4.3, to be removed in 5.0; use Twig instead.

Table of Contents

CACHE_KEY_VAR  = 'cache_key'
The variable in {@link FormView} used as cache key.
$defaultThemes  : array<string|int, mixed>
$resources  : array<string|int, array<string|int, mixed>>
$themes  : array<string|int, array<string|int, mixed>>
$useDefaultThemes  : array<string|int, bool>
$engine  : mixed
$resourceHierarchyLevels  : array<string|int, array<string|int, int|false>>
__construct()  : mixed
Creates a new renderer engine.
getResourceForBlockName()  : mixed
Returns the resource for a block name.
getResourceForBlockNameHierarchy()  : mixed
Returns the resource for a block hierarchy.
getResourceHierarchyLevel()  : int|bool
Returns the hierarchy level at which a resource can be found.
renderBlock()  : mixed
{@inheritdoc}
setTheme()  : mixed
Sets the theme(s) to be used for rendering a view and its children.
loadResourceForBlockName()  : bool
Loads the cache with the resource for a given block name.
loadResourceFromTheme()  : bool
Tries to load the resource for a block from a theme.
loadResourceForBlockNameHierarchy()  : bool
Loads the cache with the resource for a specific level of a block hierarchy.

Constants

CACHE_KEY_VAR

The variable in {@link FormView} used as cache key.

public mixed CACHE_KEY_VAR = 'cache_key'

Properties

$resourceHierarchyLevels

private array<string|int, array<string|int, int|false>> $resourceHierarchyLevels = []

Methods

__construct()

Creates a new renderer engine.

public __construct(EngineInterface $engine[, array<string|int, mixed> $defaultThemes = [] ]) : mixed
Parameters
$engine : EngineInterface
$defaultThemes : array<string|int, mixed> = []

The default themes. The type of these themes is open to the implementation.

Return values
mixed

getResourceForBlockName()

Returns the resource for a block name.

public getResourceForBlockName(FormView $view, mixed $blockName) : mixed
Parameters
$view : FormView

The view for determining the used themes. First the themes attached directly to the view with are considered, then the ones of its parent etc.

$blockName : mixed

The name of the block to render

Return values
mixed

the renderer resource or false, if none was found

getResourceForBlockNameHierarchy()

Returns the resource for a block hierarchy.

public getResourceForBlockNameHierarchy(FormView $view, array<string|int, mixed> $blockNameHierarchy, mixed $hierarchyLevel) : mixed
Parameters
$view : FormView

The view for determining the used themes. First the themes attached directly to the view with are considered, then the ones of its parent etc.

$blockNameHierarchy : array<string|int, mixed>

The block name hierarchy, with the root block at the beginning

$hierarchyLevel : mixed

The level in the hierarchy at which to start looking. Level 0 indicates the root block, i.e. the first element of $blockNameHierarchy.

Return values
mixed

The renderer resource or false, if none was found

getResourceHierarchyLevel()

Returns the hierarchy level at which a resource can be found.

public getResourceHierarchyLevel(FormView $view, array<string|int, mixed> $blockNameHierarchy, mixed $hierarchyLevel) : int|bool
Parameters
$view : FormView

The view for determining the used themes. First the themes attached directly to the view with are considered, then the ones of its parent etc.

$blockNameHierarchy : array<string|int, mixed>

The block name hierarchy, with the root block at the beginning

$hierarchyLevel : mixed

The level in the hierarchy at which to start looking. Level 0 indicates the root block, i.e. the first element of $blockNameHierarchy.

Return values
int|bool

The hierarchy level or false, if no resource was found

renderBlock()

{@inheritdoc}

public renderBlock(FormView $view, mixed $resource, mixed $blockName[, array<string|int, mixed> $variables = [] ]) : mixed
Parameters
$view : FormView
$resource : mixed
$blockName : mixed
$variables : array<string|int, mixed> = []
Return values
mixed

setTheme()

Sets the theme(s) to be used for rendering a view and its children.

public setTheme(FormView $view, mixed $themes[, mixed $useDefaultThemes = true ]) : mixed
Parameters
$view : FormView

The view to assign the theme(s) to

$themes : mixed

The theme(s). The type of these themes is open to the implementation.

$useDefaultThemes : mixed = true

If true, will use default themes specified in the engine

Return values
mixed

loadResourceForBlockName()

Loads the cache with the resource for a given block name.

protected loadResourceForBlockName(string $cacheKey, FormView $view, string $blockName) : bool

This implementation tries to load as few blocks as possible, since each block is represented by a template on the file system.

Parameters
$cacheKey : string

The cache key of the form view

$view : FormView

The form view for finding the applying themes

$blockName : string

The name of the block to load

Tags
see
getResourceForBlock()
Return values
bool

True if the resource could be loaded, false otherwise

loadResourceFromTheme()

Tries to load the resource for a block from a theme.

protected loadResourceFromTheme(string $cacheKey, string $blockName, mixed $theme) : bool
Parameters
$cacheKey : string

The cache key for storing the resource

$blockName : string

The name of the block to load a resource for

$theme : mixed

The theme to load the block from

Return values
bool

True if the resource could be loaded, false otherwise

loadResourceForBlockNameHierarchy()

Loads the cache with the resource for a specific level of a block hierarchy.

private loadResourceForBlockNameHierarchy(string $cacheKey, FormView $view, array<string|int, mixed> $blockNameHierarchy, int $hierarchyLevel) : bool
Parameters
$cacheKey : string
$view : FormView
$blockNameHierarchy : array<string|int, mixed>
$hierarchyLevel : int
Tags
see
getResourceForBlockHierarchy()
Return values
bool

Search results