diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_help.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_help.html.php new file mode 100644 index 0000000000..654bf8c92f --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_help.html.php @@ -0,0 +1,3 @@ + +

escape(false !== $translation_domain ? $view['translator']->trans($help, array(), $translation_domain) : $help) ?>

+ diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_row.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_row.html.php index a4f86d0223..11869b422a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_row.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_row.html.php @@ -2,4 +2,5 @@ label($form) ?> errors($form) ?> widget($form) ?> + help($form); ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/FormTable/form_row.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/FormTable/form_row.html.php index e2f03ff2b7..8948084cd6 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/FormTable/form_row.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/FormTable/form_row.html.php @@ -5,5 +5,6 @@ errors($form); ?> widget($form); ?> + help($form); ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php index 0ad1ff85b2..5dbc58631e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php @@ -169,6 +169,19 @@ class FormHelper extends Helper return $this->renderer->searchAndRenderBlock($view, 'label', $variables); } + /** + * Renders the help of the given view. + * + * @param FormView $view The parent view + * @param array $variables An array of variables + * + * @return string The HTML markup + */ + public function help(FormView $view, array $variables = array()) + { + return $this->renderer->searchAndRenderBlock($view, 'help', $variables); + } + /** * Renders the errors of the given view. * diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php index b86d54b78c..3c0d3064dc 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php @@ -91,6 +91,11 @@ class FormHelperDivLayoutTest extends AbstractDivLayoutTest return (string) $this->engine->get('form')->label($view, $label, $vars); } + protected function renderHelp(FormView $view, array $vars = array()) + { + return (string) $this->engine->get('form')->help($view); + } + protected function renderErrors(FormView $view) { return (string) $this->engine->get('form')->errors($view); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php index 8dd6fffa79..8c8c8e0b78 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php @@ -92,6 +92,11 @@ class FormHelperTableLayoutTest extends AbstractTableLayoutTest return (string) $this->engine->get('form')->label($view, $label, $vars); } + protected function renderHelp(FormView $view, array $vars = array()) + { + return (string) $this->engine->get('form')->help($view); + } + protected function renderErrors(FormView $view) { return (string) $this->engine->get('form')->errors($view);