Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 68a9a07

Browse filesBrowse files
bug #28113 [Form] Add help texts for checkboxes in horizontal bootstrap 4 forms (apfelbox)
This PR was merged into the 4.1 branch. Discussion ---------- [Form] Add help texts for checkboxes in horizontal bootstrap 4 forms | Q | A | ------------- | --- | Branch? | 4.1 | Bug fix? | yes | New feature? | no <!-- don't forget to update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | — | License | MIT | Doc PR | — Bootstrap 4 horizontal forms override the `{% block checkbox_form %}` but didn't include the help text. Regular (vertical) Bootstrap 4 are not affected, as they use the default `form_row`, which includes the `form_help()` call. ### Before ![before](https://user-images.githubusercontent.com/1032411/43576420-9a1051ee-9649-11e8-8c1e-89502e5a79bd.png) ### After ![after](https://user-images.githubusercontent.com/1032411/43576423-9dfe5620-9649-11e8-8bce-74ec82d83729.png) Commits ------- 1483c87 Add help texts for checkboxes in horizontal bootstrap 4 forms
2 parents 57ddb21 + 1483c87 commit 68a9a07
Copy full SHA for 68a9a07

File tree

2 files changed

+21
-0
lines changed
Filter options

2 files changed

+21
-0
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_horizontal_layout.html.twig
+1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/Tests/Extension/AbstractBootstrap4HorizontalLayoutTest.php
+20Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.