Skip to content

Commit 4dc3230

Browse files
Merge branch '4.3' into 4.4
* 4.3: [Mailer] Remove line breaks in email attachment content Update links to documentation [Validator] Add the missing translations for the Arabic (ar) locale ensure to expect no validation for the right reasons [PhpUnitBridge] Add test case for @expectedDeprecation annotation [PhpUnitBridge][SymfonyTestsListenerTrait] Remove $testsWithWarnings stack [Mailer][MailchimpBridge] Fix missing attachments when sending via Mandrill API [Mailer][MailchimpBridge] Fix incorrect sender address when sender has name [HttpClient] fix capturing SSL certificates with NativeHttpClient [TwigBridge][Form] Added missing help messages in form themes Update year in license files Update year in license files [HttpClient] fix typo [Console][FormatterHelper] Use helper strlen statically and remove duplicated code [Routing] Fix i18n routing when the url contains the locale Fix BC issue in phpDoc Reflection library [Translator] Performance improvement in MessageCatalogue and catalogue operations.
2 parents 936cf6f + a1c112b commit 4dc3230

8 files changed

+104
-1
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2004-2019 Fabien Potencier
1+
Copyright (c) 2004-2020 Fabien Potencier
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

Resources/views/Form/bootstrap_3_horizontal_layout.html.twig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ col-sm-10
6464
<div class="{{ block('form_label_class') }}"></div>{#--#}
6565
<div class="{{ block('form_group_class') }}">
6666
{{- form_widget(form) -}}
67+
{{- form_help(form) -}}
6768
{{- form_errors(form) -}}
6869
</div>{#--#}
6970
</div>

Resources/views/Form/bootstrap_3_layout.html.twig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,15 @@
148148
{% block checkbox_row -%}
149149
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group' ~ (not valid ? ' has-error'))|trim})} %}{{ block('attributes') }}{% endwith %}>
150150
{{- form_widget(form) -}}
151+
{{- form_help(form) -}}
151152
{{- form_errors(form) -}}
152153
</div>
153154
{%- endblock checkbox_row %}
154155

155156
{% block radio_row -%}
156157
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group' ~ (not valid ? ' has-error'))|trim})} %}{{ block('attributes') }}{% endwith %}>
157158
{{- form_widget(form) -}}
159+
{{- form_help(form) -}}
158160
{{- form_errors(form) -}}
159161
</div>
160162
{%- endblock radio_row %}

Resources/views/Form/foundation_5_layout.html.twig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@
311311
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' row')|trim})} %}{{ block('attributes') }}{% endwith %}>
312312
<div class="large-12 columns{% if not valid %} error{% endif %}">
313313
{{ form_widget(form) }}
314+
{{- form_help(form) -}}
314315
{{ form_errors(form) }}
315316
</div>
316317
</div>
@@ -320,6 +321,7 @@
320321
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' row')|trim})} %}{{ block('attributes') }}{% endwith %}>
321322
<div class="large-12 columns{% if not valid %} error{% endif %}">
322323
{{ form_widget(form) }}
324+
{{- form_help(form) -}}
323325
{{ form_errors(form) }}
324326
</div>
325327
</div>

Tests/Extension/AbstractBootstrap3HorizontalLayoutTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,4 +163,23 @@ public function testCheckboxRow()
163163

164164
$this->assertMatchesXpath($html, '/div[@class="form-group"]/div[@class="col-sm-2" or @class="col-sm-10"]', 2);
165165
}
166+
167+
public function testCheckboxRowWithHelp()
168+
{
169+
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType');
170+
$html = $this->renderRow($form->createView(), ['label' => 'foo', 'help' => 'really helpful text']);
171+
172+
$this->assertMatchesXpath($html,
173+
'/div
174+
[@class="form-group"]
175+
[
176+
./div[@class="col-sm-2" or @class="col-sm-10"]
177+
/following-sibling::div[@class="col-sm-2" or @class="col-sm-10"]
178+
[
179+
./span[text() = "[trans]really helpful text[/trans]"]
180+
]
181+
]
182+
'
183+
);
184+
}
166185
}

Tests/Extension/AbstractBootstrap3LayoutTest.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,21 @@ public function testCheckboxWithValue()
333333
);
334334
}
335335

336+
public function testCheckboxRowWithHelp()
337+
{
338+
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType');
339+
$html = $this->renderRow($form->createView(), ['label' => 'foo', 'help' => 'really helpful text']);
340+
341+
$this->assertMatchesXpath($html,
342+
'/div
343+
[@class="form-group"]
344+
[
345+
./span[text() = "[trans]really helpful text[/trans]"]
346+
]
347+
'
348+
);
349+
}
350+
336351
public function testSingleChoice()
337352
{
338353
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', [
@@ -2284,6 +2299,21 @@ public function testRadioWithValue()
22842299
);
22852300
}
22862301

2302+
public function testRadioRowWithHelp()
2303+
{
2304+
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RadioType', false);
2305+
$html = $this->renderRow($form->createView(), ['label' => 'foo', 'help' => 'really helpful text']);
2306+
2307+
$this->assertMatchesXpath($html,
2308+
'/div
2309+
[@class="form-group"]
2310+
[
2311+
./span[text() = "[trans]really helpful text[/trans]"]
2312+
]
2313+
'
2314+
);
2315+
}
2316+
22872317
public function testRange()
22882318
{
22892319
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RangeType', 42, ['attr' => ['min' => 5]]);

Tests/Extension/AbstractBootstrap4HorizontalLayoutTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,25 @@ public function testCheckboxRowWithHelp()
231231
./small[text() = "[trans]really helpful text[/trans]"]
232232
]
233233
]
234+
'
235+
);
236+
}
237+
238+
public function testRadioRowWithHelp()
239+
{
240+
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RadioType', false);
241+
$html = $this->renderRow($form->createView(), ['label' => 'foo', 'help' => 'really helpful text']);
242+
243+
$this->assertMatchesXpath($html,
244+
'/div
245+
[@class="form-group row"]
246+
[
247+
./div[@class="col-sm-2" or @class="col-sm-10"]
248+
/following-sibling::div[@class="col-sm-2" or @class="col-sm-10"]
249+
[
250+
./small[text() = "[trans]really helpful text[/trans]"]
251+
]
252+
]
234253
'
235254
);
236255
}

Tests/Extension/AbstractBootstrap4LayoutTest.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,21 @@ public function testCheckboxWithValue()
422422
);
423423
}
424424

425+
public function testCheckboxRowWithHelp()
426+
{
427+
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType');
428+
$html = $this->renderRow($form->createView(), ['label' => 'foo', 'help' => 'really helpful text']);
429+
430+
$this->assertMatchesXpath($html,
431+
'/div
432+
[@class="form-group"]
433+
[
434+
./small[text() = "[trans]really helpful text[/trans]"]
435+
]
436+
'
437+
);
438+
}
439+
425440
public function testSingleChoiceExpanded()
426441
{
427442
$form = $this->factory->createNamed('name', ChoiceType::class, '&a', [
@@ -1027,6 +1042,21 @@ public function testRadioWithValue()
10271042
);
10281043
}
10291044

1045+
public function testRadioRowWithHelp()
1046+
{
1047+
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RadioType', false);
1048+
$html = $this->renderRow($form->createView(), ['label' => 'foo', 'help' => 'really helpful text']);
1049+
1050+
$this->assertMatchesXpath($html,
1051+
'/div
1052+
[@class="form-group"]
1053+
[
1054+
./small[text() = "[trans]really helpful text[/trans]"]
1055+
]
1056+
'
1057+
);
1058+
}
1059+
10301060
public function testButtonAttributeNameRepeatedIfTrue()
10311061
{
10321062
$form = $this->factory->createNamed('button', ButtonType::class, null, [

0 commit comments

Comments
 (0)