FormRenderer
in package
implements
FormRendererInterface
Renders a form into HTML using a rendering engine.
Tags
Interfaces, Classes, Traits and Enums
- FormRendererInterface
- Renders a form into HTML.
Table of Contents
- CACHE_KEY_VAR = 'unique_block_prefix'
- $blockNameHierarchyMap : mixed
- $csrfTokenManager : mixed
- $engine : mixed
- $hierarchyLevelMap : mixed
- $variableStack : mixed
- __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
mixed
$blockNameHierarchyMap
= []
$csrfTokenManager
private
mixed
$csrfTokenManager
$engine
private
mixed
$engine
$hierarchyLevelMap
private
mixed
$hierarchyLevelMap
= []
$variableStack
private
mixed
$variableStack
= []
Methods
__construct()
public
__construct(FormRendererEngineInterface $engine[, CsrfTokenManagerInterface $csrfTokenManager = null ]) : mixed
Parameters
- $engine : FormRendererEngineInterface
- $csrfTokenManager : CsrfTokenManagerInterface = null
Return values
mixed —getEngine()
Returns the engine used by this renderer.
public
getEngine() : FormRendererEngineInterface
Return values
FormRendererEngineInterface —The renderer engine
humanize()
Makes a technical name human readable.
public
humanize(mixed $text) : string
Parameters
- $text : mixed
-
The text to humanize
Return values
string —The humanized text
renderBlock()
Renders a named block of the form theme.
public
renderBlock(FormView $view, mixed $blockName[, array<string|int, mixed> $variables = [] ]) : string
Parameters
- $view : FormView
-
The view for which to render the block
- $blockName : mixed
-
The name of the block
- $variables : array<string|int, mixed> = []
-
The variables to pass to the template
Return values
string —The HTML markup
renderCsrfToken()
Renders a CSRF token.
public
renderCsrfToken(mixed $tokenId) : string
Parameters
- $tokenId : mixed
-
The ID of the CSRF token
Return values
string —A CSRF token
searchAndRenderBlock()
Searches and renders a block for a given name suffix.
public
searchAndRenderBlock(FormView $view, mixed $blockNameSuffix[, array<string|int, mixed> $variables = [] ]) : string
Parameters
- $view : FormView
-
The view for which to render the block
- $blockNameSuffix : mixed
-
The suffix of the block name
- $variables : array<string|int, mixed> = []
-
The variables to pass to the template
Return values
string —The HTML markup
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 renderer