]>
git.immae.eu Git - github/wallabag/wallabag.git/blob - vendor/symfony/form/Symfony/Component/Form/FormRendererInterface.php
4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Form
;
15 * Renders a form into HTML.
17 * @author Bernhard Schussek <bschussek@gmail.com>
19 interface FormRendererInterface
22 * Returns the engine used by this renderer.
24 * @return FormRendererEngineInterface The renderer engine.
26 public function getEngine();
29 * Sets the theme(s) to be used for rendering a view and its children.
31 * @param FormView $view The view to assign the theme(s) to.
32 * @param mixed $themes The theme(s). The type of these themes
33 * is open to the implementation.
35 public function setTheme(FormView
$view, $themes);
38 * Renders a named block of the form theme.
40 * @param FormView $view The view for which to render the block.
41 * @param string $blockName The name of the block.
42 * @param array $variables The variables to pass to the template.
44 * @return string The HTML markup
46 public function renderBlock(FormView
$view, $blockName, array $variables = array());
49 * Searches and renders a block for a given name suffix.
51 * The block is searched by combining the block names stored in the
52 * form view with the given suffix. If a block name is found, that
55 * If this method is called recursively, the block search is continued
56 * where a block was found before.
58 * @param FormView $view The view for which to render the block.
59 * @param string $blockNameSuffix The suffix of the block name.
60 * @param array $variables The variables to pass to the template.
62 * @return string The HTML markup
64 public function searchAndRenderBlock(FormView
$view, $blockNameSuffix, array $variables = array());
67 * Renders a CSRF token.
69 * Use this helper for CSRF protection without the overhead of creating a
73 * <input type="hidden" name="token" value="<?php $renderer->renderCsrfToken('rm_user_'.$user->getId()) ?>">
76 * Check the token in your action using the same intention.
79 * $csrfProvider = $this->get('form.csrf_provider');
80 * if (!$csrfProvider->isCsrfTokenValid('rm_user_'.$user->getId(), $token)) {
81 * throw new \RuntimeException('CSRF attack detected.');
85 * @param string $intention The intention of the protected action
87 * @return string A CSRF token
89 public function renderCsrfToken($intention);
92 * Makes a technical name human readable.
94 * Sequences of underscores are replaced by single spaces. The first letter
95 * of the resulting string is capitalized, while all other letters are
96 * turned to lowercase.
98 * @param string $text The text to humanize.
100 * @return string The humanized text.
102 public function humanize($text);