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 91b28ff

Browse filesBrowse files
minor #29654 [Twig] Replace for-loops with blocks for attributes (royklutman)
This PR was squashed before being merged into the 3.4 branch (closes #29654). Discussion ---------- [Twig] Replace for-loops with blocks for attributes | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | | Fixed tickets | | License | MIT | Doc PR | As mentioned in #29636, replaced for-loops with blocks for attributes to make use of its features. Commits ------- 0cd8088 [Twig] Replace for-loops with blocks for attributes
2 parents e1b35b4 + 0cd8088 commit 91b28ff
Copy full SHA for 91b28ff

File tree

Expand file treeCollapse file tree

4 files changed

+4
-4
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+4
-4
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
{% set label = name|humanize %}
9999
{%- endif -%}
100100
{%- endif -%}
101-
<label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>
101+
<label{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}>
102102
{{- widget|raw }} {{ label is not same as(false) ? (translation_domain is same as(false) ? label : label|trans({}, translation_domain)) -}}
103103
</label>
104104
{%- endif -%}

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

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@
248248
{%- endif -%}
249249

250250
{{ widget|raw }}
251-
<label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>
251+
<label{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}>
252252
{{- label is not same as(false) ? (translation_domain is same as(false) ? label : label|trans({}, translation_domain)) -}}
253253
{{- form_errors(form) -}}
254254
</label>

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

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@
327327
{%- else -%}
328328
{% set form_method = "POST" %}
329329
{%- endif -%}
330-
<form{% if name != '' %} name="{{ name }}"{% endif %} method="{{ form_method|lower }}"{% if action != '' %} action="{{ action }}"{% endif %}{% for attrname, attrvalue in attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}{% if multipart %} enctype="multipart/form-data"{% endif %}>
330+
<form{% if name != '' %} name="{{ name }}"{% endif %} method="{{ form_method|lower }}"{% if action != '' %} action="{{ action }}"{% endif %}{{ block('attributes') }}{% if multipart %} enctype="multipart/form-data"{% endif %}>
331331
{%- if form_method != method -%}
332332
<input type="hidden" name="_method" value="{{ method }}" />
333333
{%- endif -%}

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

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/Resources/views/Form/foundation_5_layout.html.twig
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@
258258
{% set label = name|humanize %}
259259
{%- endif -%}
260260
{% endif %}
261-
<label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>
261+
<label{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}>
262262
{{ widget|raw }}
263263
{{ translation_domain is same as(false) ? label : label|trans({}, translation_domain) }}
264264
</label>

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.