Skip to content

Commit ba798df

Browse files
Mathieu Piotmpiot
authored andcommitted
FrameworkBundle Tests
1 parent 4f2581d commit ba798df

File tree

6 files changed

+28
-0
lines changed

6 files changed

+28
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php if (!empty($help)): ?>
2+
<p class="help-text"><?php echo $view->escape(false !== $translation_domain ? $view['translator']->trans($help, array(), $translation_domain) : $help) ?></p>
3+
<?php endif ?>

src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_row.html.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
<?php echo $view['form']->label($form) ?>
33
<?php echo $view['form']->errors($form) ?>
44
<?php echo $view['form']->widget($form) ?>
5+
<?php echo $view['form']->help($form); ?>
56
</div>

src/Symfony/Bundle/FrameworkBundle/Resources/views/FormTable/form_row.html.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
<td>
66
<?php echo $view['form']->errors($form); ?>
77
<?php echo $view['form']->widget($form); ?>
8+
<?php echo $view['form']->help($form); ?>
89
</td>
910
</tr>

src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,19 @@ public function label(FormView $view, $label = null, array $variables = array())
169169
return $this->renderer->searchAndRenderBlock($view, 'label', $variables);
170170
}
171171

172+
/**
173+
* Renders the help of the given view.
174+
*
175+
* @param FormView $view The parent view
176+
* @param array $variables An array of variables
177+
*
178+
* @return string The HTML markup
179+
*/
180+
public function help(FormView $view, array $variables = array())
181+
{
182+
return $this->renderer->searchAndRenderBlock($view, 'help', $variables);
183+
}
184+
172185
/**
173186
* Renders the errors of the given view.
174187
*

src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ protected function renderLabel(FormView $view, $label = null, array $vars = arra
9191
return (string) $this->engine->get('form')->label($view, $label, $vars);
9292
}
9393

94+
protected function renderHelp(FormView $view, array $vars = array())
95+
{
96+
return (string) $this->engine->get('form')->help($view);
97+
}
98+
9499
protected function renderErrors(FormView $view)
95100
{
96101
return (string) $this->engine->get('form')->errors($view);

src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ protected function renderLabel(FormView $view, $label = null, array $vars = arra
9292
return (string) $this->engine->get('form')->label($view, $label, $vars);
9393
}
9494

95+
protected function renderHelp(FormView $view, array $vars = array())
96+
{
97+
return (string) $this->engine->get('form')->help($view);
98+
}
99+
95100
protected function renderErrors(FormView $view)
96101
{
97102
return (string) $this->engine->get('form')->errors($view);

0 commit comments

Comments
 (0)