Skip to content

Commit 1483c87

Browse files
author
Jannik Zschiesche
committed
Add help texts for checkboxes in horizontal bootstrap 4 forms
1 parent d0a97b4 commit 1483c87

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_horizontal_layout.html.twig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ col-sm-10
8181
<div class="{{ block('form_label_class') }}"></div>{#--#}
8282
<div class="{{ block('form_group_class') }}">
8383
{{- form_widget(form) -}}
84+
{{- form_help(form) -}}
8485
{{- form_errors(form) -}}
8586
</div>{#--#}
8687
</div>

src/Symfony/Bridge/Twig/Tests/Extension/AbstractBootstrap4HorizontalLayoutTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,4 +214,24 @@ public function testCheckboxRow()
214214

215215
$this->assertMatchesXpath($html, '/div[@class="form-group row"]/div[@class="col-sm-2" or @class="col-sm-10"]', 2);
216216
}
217+
218+
public function testCheckboxRowWithHelp()
219+
{
220+
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType');
221+
$view = $form->createView();
222+
$html = $this->renderRow($view, array('label' => 'foo', 'help' => 'really helpful text'));
223+
224+
$this->assertMatchesXpath($html,
225+
'/div
226+
[@class="form-group row"]
227+
[
228+
./div[@class="col-sm-2" or @class="col-sm-10"]
229+
/following-sibling::div[@class="col-sm-2" or @class="col-sm-10"]
230+
[
231+
./small[text() = "[trans]really helpful text[/trans]"]
232+
]
233+
]
234+
'
235+
);
236+
}
217237
}

0 commit comments

Comments
 (0)