Skip to content

Commit d36e85e

Browse files
Merge branch '4.3' into 4.4
* 4.3: Fix tests [Console] Fix commands description with numeric namespaces [HttpFoundation] Fixed typo [EventDispatcher] Better error reporting when arguments to dispatch() are swapped [Serializer] CsvEncoder::NO_HEADERS_KEY ignored when used in constructor [Form] Keep preferred_choices order for choice groups [Debug] work around failing chdir() on Darwin [PhpUnitBridge] Read configuration CLI directive [DI] Missing test on YamlFileLoader Revert "minor #34608 [Process] add tests for php executable finder if file does not exist (ahmedash95)" Simpler example for Apache basic auth workaround [Console] Fix trying to access array offset on value of type int [Config] Remove extra sprintf arg [VarDumper] notice on potential undefined index [HttpClient] turn exception into log when the request has no content-type [Process] add tests for php executable finder if file does not exist [Cache] Make sure we get the correct number of values from redis::mget() [TwigBridge] Add row_attr to all form themes [Serializer] Fix MetadataAwareNameConverter usage with string group
2 parents 5f0baa3 + 3608566 commit d36e85e

9 files changed

+25
-24
lines changed

Resources/views/Form/bootstrap_3_horizontal_layout.html.twig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ col-sm-2
2727
{%- if help is not empty -%}
2828
{%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%}
2929
{%- endif -%}
30-
<div class="form-group{% if (not compound or force_error|default(false)) and not valid %} has-error{% endif %}">
30+
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group' ~ ((not compound or force_error|default(false)) and not valid ? ' has-error'))|trim})} %}{{ block('attributes') }}{% endwith %}>
3131
{{- form_label(form) -}}
3232
<div class="{{ block('form_group_class') }}">
3333
{{- form_widget(form, widget_attr) -}}
@@ -38,7 +38,7 @@ col-sm-2
3838
{%- endblock form_row %}
3939

4040
{% block submit_row -%}
41-
<div class="form-group">{#--#}
41+
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group')|trim})} %}{{ block('attributes') }}{% endwith %}>{#--#}
4242
<div class="{{ block('form_label_class') }}"></div>{#--#}
4343
<div class="{{ block('form_group_class') }}">
4444
{{- form_widget(form) -}}
@@ -47,7 +47,7 @@ col-sm-2
4747
{%- endblock submit_row %}
4848

4949
{% block reset_row -%}
50-
<div class="form-group">{#--#}
50+
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group')|trim})} %}{{ block('attributes') }}{% endwith %}>{#--#}
5151
<div class="{{ block('form_label_class') }}"></div>{#--#}
5252
<div class="{{ block('form_group_class') }}">
5353
{{- form_widget(form) -}}
@@ -60,7 +60,7 @@ col-sm-10
6060
{%- endblock form_group_class %}
6161

6262
{% block checkbox_row -%}
63-
<div class="form-group{% if not valid %} has-error{% endif %}">{#--#}
63+
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group' ~ (not valid ? ' has-error'))|trim})} %}{{ block('attributes') }}{% endwith %}>{#--#}
6464
<div class="{{ block('form_label_class') }}"></div>{#--#}
6565
<div class="{{ block('form_group_class') }}">
6666
{{- form_widget(form) -}}

Resources/views/Form/bootstrap_3_layout.html.twig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
{%- if help is not empty -%}
112112
{%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%}
113113
{%- endif -%}
114-
<div class="form-group{% if (not compound or force_error|default(false)) and not valid %} has-error{% endif %}">
114+
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group' ~ ((not compound or force_error|default(false)) and not valid ? ' has-error'))|trim})} %}{{ block('attributes') }}{% endwith %}>
115115
{{- form_label(form) }} {# -#}
116116
{{ form_widget(form, widget_attr) }} {# -#}
117117
{{- form_help(form) -}}
@@ -120,7 +120,7 @@
120120
{%- endblock form_row %}
121121

122122
{% block button_row -%}
123-
<div class="form-group">
123+
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group')|trim})} %}{{ block('attributes') }}{% endwith %}>
124124
{{- form_widget(form) -}}
125125
</div>
126126
{%- endblock button_row %}
@@ -146,14 +146,14 @@
146146
{%- endblock datetime_row %}
147147

148148
{% block checkbox_row -%}
149-
<div class="form-group{% if not valid %} has-error{% endif %}">
149+
<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) -}}
151151
{{- form_errors(form) -}}
152152
</div>
153153
{%- endblock checkbox_row %}
154154

155155
{% block radio_row -%}
156-
<div class="form-group{% if not valid %} has-error{% endif %}">
156+
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group' ~ (not valid ? ' has-error'))|trim})} %}{{ block('attributes') }}{% endwith %}>
157157
{{- form_widget(form) -}}
158158
{{- form_errors(form) -}}
159159
</div>

Resources/views/Form/bootstrap_4_horizontal_layout.html.twig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ col-sm-2
2828
{%- if help is not empty -%}
2929
{%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%}
3030
{%- endif -%}
31-
<div class="form-group row{% if (not compound or force_error|default(false)) and not valid %} is-invalid{% endif %}">
31+
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group row' ~ ((not compound or force_error|default(false)) and not valid ? ' is-invalid'))|trim})} %}{{ block('attributes') }}{% endwith %}>
3232
{{- form_label(form) -}}
3333
<div class="{{ block('form_group_class') }}">
3434
{{- form_widget(form, widget_attr) -}}
@@ -43,7 +43,7 @@ col-sm-2
4343
{%- if help is not empty -%}
4444
{%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%}
4545
{%- endif -%}
46-
<fieldset class="form-group">
46+
<fieldset{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group')|trim})} %}{{ block('attributes') }}{% endwith %}>
4747
<div class="row{% if (not compound or force_error|default(false)) and not valid %} is-invalid{% endif %}">
4848
{{- form_label(form) -}}
4949
<div class="{{ block('form_group_class') }}">
@@ -55,7 +55,7 @@ col-sm-2
5555
{%- endblock fieldset_form_row %}
5656

5757
{% block submit_row -%}
58-
<div class="form-group row">{#--#}
58+
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group row')|trim})} %}{{ block('attributes') }}{% endwith %}>{#--#}
5959
<div class="{{ block('form_label_class') }}"></div>{#--#}
6060
<div class="{{ block('form_group_class') }}">
6161
{{- form_widget(form) -}}
@@ -64,7 +64,7 @@ col-sm-2
6464
{%- endblock submit_row %}
6565

6666
{% block reset_row -%}
67-
<div class="form-group row">{#--#}
67+
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group row')|trim})} %}{{ block('attributes') }}{% endwith %}>{#--#}
6868
<div class="{{ block('form_label_class') }}"></div>{#--#}
6969
<div class="{{ block('form_group_class') }}">
7070
{{- form_widget(form) -}}
@@ -77,7 +77,7 @@ col-sm-10
7777
{%- endblock form_group_class %}
7878

7979
{% block checkbox_row -%}
80-
<div class="form-group row">{#--#}
80+
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group row')|trim})} %}{{ block('attributes') }}{% endwith %}>{#--#}
8181
<div class="{{ block('form_label_class') }}"></div>{#--#}
8282
<div class="{{ block('form_group_class') }}">
8383
{{- form_widget(form) -}}

Resources/views/Form/bootstrap_4_layout.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@
287287
{%- if help is not empty -%}
288288
{%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%}
289289
{%- endif -%}
290-
<{{ element|default('div') }} class="form-group">
290+
<{{ element|default('div') }}{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group')|trim})} %}{{ block('attributes') }}{% endwith %}>
291291
{{- form_label(form) -}}
292292
{{- form_widget(form, widget_attr) -}}
293293
{{- form_help(form) -}}

Resources/views/Form/bootstrap_base_layout.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
{# Rows #}
188188

189189
{% block button_row -%}
190-
<div class="form-group">
190+
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group')|trim})} %}{{ block('attributes') }}{% endwith %}>
191191
{{- form_widget(form) -}}
192192
</div>
193193
{%- endblock button_row %}

Resources/views/Form/form_div_layout.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@
336336
{%- if help is not empty -%}
337337
{%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%}
338338
{%- endif -%}
339-
<div {% with {attr: row_attr|default({})} %}{{ block('attributes') }}{% endwith %}>
339+
<div{% with {attr: row_attr} %}{{ block('attributes') }}{% endwith %}>
340340
{{- form_label(form) -}}
341341
{{- form_errors(form) -}}
342342
{{- form_widget(form, widget_attr) -}}
@@ -345,7 +345,7 @@
345345
{%- endblock form_row -%}
346346

347347
{%- block button_row -%}
348-
<div {% with {attr: row_attr|default({})} %}{{ block('attributes') }}{% endwith %}>
348+
<div{% with {attr: row_attr} %}{{ block('attributes') }}{% endwith %}>
349349
{{- form_widget(form) -}}
350350
</div>
351351
{%- endblock button_row -%}

Resources/views/Form/form_table_layout.html.twig

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{%- if help is not empty -%}
66
{%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%}
77
{%- endif -%}
8-
<tr>
8+
<tr{% with {attr: row_attr} %}{{ block('attributes') }}{% endwith %}>
99
<td>
1010
{{- form_label(form) -}}
1111
</td>
@@ -18,7 +18,7 @@
1818
{%- endblock form_row -%}
1919

2020
{%- block button_row -%}
21-
<tr>
21+
<tr{% with {attr: row_attr} %}{{ block('attributes') }}{% endwith %}>
2222
<td></td>
2323
<td>
2424
{{- form_widget(form) -}}
@@ -27,7 +27,8 @@
2727
{%- endblock button_row -%}
2828

2929
{%- block hidden_row -%}
30-
<tr style="display: none">
30+
{%- set style = row_attr.style is defined ? (row_attr.style ~ (row_attr.style|trim|last != ';' ? '; ')) : '' -%}
31+
<tr{% with {attr: row_attr|merge({style: (style ~ ' display: none')|trim})} %}{{ block('attributes') }}{% endwith %}>
3132
<td colspan="2">
3233
{{- form_widget(form) -}}
3334
</td>

Resources/views/Form/foundation_5_layout.html.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@
277277
{%- if help is not empty -%}
278278
{%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%}
279279
{%- endif -%}
280-
<div class="row">
280+
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' row')|trim})} %}{{ block('attributes') }}{% endwith %}>
281281
<div class="large-12 columns{% if (not compound or force_error|default(false)) and not valid %} error{% endif %}">
282282
{{- form_label(form) -}}
283283
{{- form_widget(form, widget_attr) -}}
@@ -308,7 +308,7 @@
308308
{%- endblock datetime_row %}
309309

310310
{% block checkbox_row -%}
311-
<div class="row">
311+
<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) }}
314314
{{ form_errors(form) }}
@@ -317,7 +317,7 @@
317317
{%- endblock checkbox_row %}
318318

319319
{% block radio_row -%}
320-
<div class="row">
320+
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' row')|trim})} %}{{ block('attributes') }}{% endwith %}>
321321
<div class="large-12 columns{% if not valid %} error{% endif %}">
322322
{{ form_widget(form) }}
323323
{{ form_errors(form) }}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"symfony/dependency-injection": "^3.4|^4.0|^5.0",
2727
"symfony/error-handler": "^4.4|^5.0",
2828
"symfony/finder": "^3.4|^4.0|^5.0",
29-
"symfony/form": "^4.4|^5.0",
29+
"symfony/form": "^4.3.5",
3030
"symfony/http-foundation": "^4.3|^5.0",
3131
"symfony/http-kernel": "^4.4",
3232
"symfony/mime": "^4.3|^5.0",

0 commit comments

Comments
 (0)