PHP Class Symfony\Bridge\Twig\Form\TwigRendererEngine

Author: Bernhard Schussek ([email protected])
Inheritance: extends Symfony\Component\Form\AbstractRendererEngine, implements Symfony\Bridge\Twig\Form\TwigRendererEngineInterface
Datei anzeigen Open project: symfony/symfony Class Usage Examples

Public Methods

Method Description
__construct ( array $defaultThemes = [], Twig_Environment $environment = null )
renderBlock ( Symfony\Component\Form\FormView $view, $resource, $blockName, array $variables = [] )
setEnvironment ( Twig_Environment $environment )

Protected Methods

Method Description
loadResourceForBlockName ( string $cacheKey, Symfony\Component\Form\FormView $view, string $blockName ) : boolean Loads the cache with the resource for a given block name.
loadResourcesFromTheme ( string $cacheKey, mixed &$theme ) Loads the resources for all blocks in a theme.

Method Details

__construct() public method

public __construct ( array $defaultThemes = [], Twig_Environment $environment = null )
$defaultThemes array
$environment Twig_Environment

loadResourceForBlockName() protected method

This implementation eagerly loads all blocks of the themes assigned to the given view and all of its ancestors views. This is necessary, because Twig receives the list of blocks later. At that point, all blocks must already be loaded, for the case that the function "block()" is used in the Twig template.
See also: getResourceForBlock()
protected loadResourceForBlockName ( string $cacheKey, Symfony\Component\Form\FormView $view, string $blockName ) : boolean
$cacheKey string The cache key of the form view
$view Symfony\Component\Form\FormView The form view for finding the applying themes
$blockName string The name of the block to load
return boolean True if the resource could be loaded, false otherwise

loadResourcesFromTheme() protected method

Loads the resources for all blocks in a theme.
protected loadResourcesFromTheme ( string $cacheKey, mixed &$theme )
$cacheKey string The cache key for storing the resource
$theme mixed The theme to load the block from. This parameter is passed by reference, because it might be necessary to initialize the theme first. Any changes made to this variable will be kept and be available upon further calls to this method using the same theme.

renderBlock() public method

public renderBlock ( Symfony\Component\Form\FormView $view, $resource, $blockName, array $variables = [] )
$view Symfony\Component\Form\FormView
$variables array

setEnvironment() public method

Deprecation: since version 3.3, to be removed in 4.0
public setEnvironment ( Twig_Environment $environment )
$environment Twig_Environment