FormRenderer
in package
implements
FormRendererInterface
Renders a form into HTML using a rendering engine.
Tags
Table of Contents
Interfaces
- FormRendererInterface
- Renders a form into HTML.
Constants
- CACHE_KEY_VAR = 'unique_block_prefix'
Properties
- $blockNameHierarchyMap : array<string|int, mixed>
- $csrfTokenManager : mixed
- $engine : mixed
- $hierarchyLevelMap : array<string|int, mixed>
- $variableStack : array<string|int, mixed>
Methods
- __construct() : mixed
- getEngine() : FormRendererEngineInterface
- Returns the engine used by this renderer.
- humanize() : string
- Makes a technical name human readable.
- renderBlock() : string
- Renders a named block of the form theme.
- renderCsrfToken() : string
- Renders a CSRF token.
- searchAndRenderBlock() : string
- Searches and renders a block for a given name suffix.
- setTheme() : mixed
- Sets the theme(s) to be used for rendering a view and its children.
Constants
CACHE_KEY_VAR
public
mixed
CACHE_KEY_VAR
= 'unique_block_prefix'
Properties
$blockNameHierarchyMap
private
array<string|int, mixed>
$blockNameHierarchyMap
= []
$csrfTokenManager
private
mixed
$csrfTokenManager
$engine
private
mixed
$engine
$hierarchyLevelMap
private
array<string|int, mixed>
$hierarchyLevelMap
= []
$variableStack
private
array<string|int, mixed>
$variableStack
= []
Methods
__construct()
public
__construct(FormRendererEngineInterface $engine[, CsrfTokenManagerInterface $csrfTokenManager = null ]) : mixed
Parameters
- $engine : FormRendererEngineInterface
- $csrfTokenManager : CsrfTokenManagerInterface = null
getEngine()
Returns the engine used by this renderer.
public
getEngine() : FormRendererEngineInterface
Return values
FormRendererEngineInterfacehumanize()
Makes a technical name human readable.
public
humanize(string $text) : string
Parameters
- $text : string
Return values
stringrenderBlock()
Renders a named block of the form theme.
public
renderBlock(FormView $view, string $blockName[, array<string|int, mixed> $variables = [] ]) : string
Parameters
- $view : FormView
-
The view for which to render the block
- $blockName : string
- $variables : array<string|int, mixed> = []
-
The variables to pass to the template
Return values
stringrenderCsrfToken()
Renders a CSRF token.
public
renderCsrfToken(string $tokenId) : string
Parameters
- $tokenId : string
Return values
stringsearchAndRenderBlock()
Searches and renders a block for a given name suffix.
public
searchAndRenderBlock(FormView $view, string $blockNameSuffix[, array<string|int, mixed> $variables = [] ]) : string
Parameters
- $view : FormView
-
The view for which to render the block
- $blockNameSuffix : string
- $variables : array<string|int, mixed> = []
-
The variables to pass to the template
Return values
stringsetTheme()
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
-
If true, will use default themes specified in the renderer