AbstractRendererEngine
in package
implements
FormRendererEngineInterface, ResetInterface
Default implementation of {@link FormRendererEngineInterface}.
Tags
Table of Contents
Interfaces
- FormRendererEngineInterface
- Adapter for rendering form templates with a specific templating engine.
- ResetInterface
- Provides a way to reset an object to its initial state.
Constants
- CACHE_KEY_VAR = 'cache_key'
- The variable in {@link FormView} used as cache key.
Properties
- $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>
- $resourceHierarchyLevels : array<string|int, array<string|int, int|false>>
Methods
- __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|false
- Returns the hierarchy level at which a resource can be found.
- reset() : void
- 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.
- 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
$defaultThemes
protected
array<string|int, mixed>
$defaultThemes
$resources
protected
array<string|int, array<string|int, mixed>>
$resources
= []
$themes
protected
array<string|int, array<string|int, mixed>>
$themes
= []
$useDefaultThemes
protected
array<string|int, bool>
$useDefaultThemes
= []
$resourceHierarchyLevels
private
array<string|int, array<string|int, int|false>>
$resourceHierarchyLevels
= []
Methods
__construct()
Creates a new renderer engine.
public
__construct([array<string|int, mixed> $defaultThemes = [] ]) : mixed
Parameters
- $defaultThemes : array<string|int, mixed> = []
-
The default themes. The type of these themes is open to the implementation.
getResourceForBlockName()
Returns the resource for a block name.
public
getResourceForBlockName(FormView $view, string $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 : string
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, int $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 : int
-
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, int $hierarchyLevel) : int|false
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 : int
-
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|falsereset()
public
reset() : void
setTheme()
Sets the theme(s) to be used for rendering a view and its children.
public
setTheme(FormView $view, mixed $themes[, bool $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 : bool = true
loadResourceForBlockName()
Loads the cache with the resource for a given block name.
protected
abstract loadResourceForBlockName(string $cacheKey, FormView $view, string $blockName) : bool
Parameters
- $cacheKey : string
- $view : FormView
- $blockName : string
Tags
Return values
boolloadResourceForBlockNameHierarchy()
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