[Twig] Replace for-loops with blocks for attributes
This commit is contained in:
parent
88525d71bf
commit
0cd8088a6d
@ -98,7 +98,7 @@
|
|||||||
{% set label = name|humanize %}
|
{% set label = name|humanize %}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
<label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>
|
<label{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}>
|
||||||
{{- widget|raw }} {{ label is not same as(false) ? (translation_domain is same as(false) ? label : label|trans({}, translation_domain)) -}}
|
{{- widget|raw }} {{ label is not same as(false) ? (translation_domain is same as(false) ? label : label|trans({}, translation_domain)) -}}
|
||||||
</label>
|
</label>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
@ -248,7 +248,7 @@
|
|||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
||||||
{{ widget|raw }}
|
{{ widget|raw }}
|
||||||
<label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>
|
<label{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}>
|
||||||
{{- label is not same as(false) ? (translation_domain is same as(false) ? label : label|trans({}, translation_domain)) -}}
|
{{- label is not same as(false) ? (translation_domain is same as(false) ? label : label|trans({}, translation_domain)) -}}
|
||||||
{{- form_errors(form) -}}
|
{{- form_errors(form) -}}
|
||||||
</label>
|
</label>
|
||||||
|
@ -327,7 +327,7 @@
|
|||||||
{%- else -%}
|
{%- else -%}
|
||||||
{% set form_method = "POST" %}
|
{% set form_method = "POST" %}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
<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 %}>
|
<form{% if name != '' %} name="{{ name }}"{% endif %} method="{{ form_method|lower }}"{% if action != '' %} action="{{ action }}"{% endif %}{{ block('attributes') }}{% if multipart %} enctype="multipart/form-data"{% endif %}>
|
||||||
{%- if form_method != method -%}
|
{%- if form_method != method -%}
|
||||||
<input type="hidden" name="_method" value="{{ method }}" />
|
<input type="hidden" name="_method" value="{{ method }}" />
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
@ -258,7 +258,7 @@
|
|||||||
{% set label = name|humanize %}
|
{% set label = name|humanize %}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>
|
<label{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}>
|
||||||
{{ widget|raw }}
|
{{ widget|raw }}
|
||||||
{{ translation_domain is same as(false) ? label : label|trans({}, translation_domain) }}
|
{{ translation_domain is same as(false) ? label : label|trans({}, translation_domain) }}
|
||||||
</label>
|
</label>
|
||||||
|
Reference in New Issue
Block a user