TwigRendererInterface

interface TwigRendererInterface implements FormRendererInterface

Methods

FormRendererEngineInterface getEngine()

Returns the engine used by this renderer.

from FormRendererInterface
setTheme(FormView $view, mixed $themes)

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

from FormRendererInterface
string renderBlock(FormView $view, string $blockName, array $variables = array())

Renders a named block of the form theme.

from FormRendererInterface
string searchAndRenderBlock(FormView $view, string $blockNameSuffix, array $variables = array())

Searches and renders a block for a given name suffix.

from FormRendererInterface
string renderCsrfToken(string $intention)

Renders a CSRF token.

from FormRendererInterface
string humanize(string $text)

Makes a technical name human readable.

from FormRendererInterface
setEnvironment(Twig_Environment $environment)

Sets Twig's environment.

Details

FormRendererEngineInterface getEngine()

Returns the engine used by this renderer.

Return Value

FormRendererEngineInterface The renderer engine.

setTheme(FormView $view, mixed $themes)

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

Parameters

FormView $view The view to assign the theme(s) to.
mixed $themes The theme(s). The type of these themes is open to the implementation.

string renderBlock(FormView $view, string $blockName, array $variables = array())

Renders a named block of the form theme.

Parameters

FormView $view The view for which to render the block.
string $blockName The name of the block.
array $variables The variables to pass to the template.

Return Value

string The HTML markup

string searchAndRenderBlock(FormView $view, string $blockNameSuffix, array $variables = array())

Searches and renders a block for a given name suffix.

The block is searched by combining the block names stored in the form view with the given suffix. If a block name is found, that block is rendered.

If this method is called recursively, the block search is continued where a block was found before.

Parameters

FormView $view The view for which to render the block.
string $blockNameSuffix The suffix of the block name.
array $variables The variables to pass to the template.

Return Value

string The HTML markup

string renderCsrfToken(string $intention)

Renders a CSRF token.

Use this helper for CSRF protection without the overhead of creating a form.

Check the token in your action using the same intention.

$csrfProvider = $this->get('form.csrfprovider'); if (!$csrfProvider->isCsrfTokenValid('rmuser_'.$user->getId(), $token)) { throw new \RuntimeException('CSRF attack detected.'); }

Parameters

string $intention The intention of the protected action

Return Value

string A CSRF token

string humanize(string $text)

Makes a technical name human readable.

Sequences of underscores are replaced by single spaces. The first letter of the resulting string is capitalized, while all other letters are turned to lowercase.

Parameters

string $text The text to humanize.

Return Value

string The humanized text.

setEnvironment(Twig_Environment $environment)

Sets Twig's environment.

Parameters

Twig_Environment $environment
doc_Symfony
2016-10-28 06:35:46
Comments
Leave a Comment

Please login to continue.