Skip to content

Commit 99ac045

Browse files
committed
Internal: Remove the deprecated Twig filter/tag spaceless
1 parent e985cdc commit 99ac045

File tree

4 files changed

+70
-92
lines changed

4 files changed

+70
-92
lines changed

public/main/template/default/document/recycle.html.twig

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{% macro bytesToSize(bytes) %}
2-
{% apply spaceless %}
32
{% set kilobyte = 1024 %}
43
{% set megabyte = kilobyte * 1024 %}
54
{% set gigabyte = megabyte * 1024 %}
@@ -16,7 +15,6 @@
1615
{% else %}
1716
{{ (bytes / terabyte)|number_format(2, '.') ~ ' TB' }}
1817
{% endif %}
19-
{% endapply %}
2018
{% endmacro %}
2119

2220
{% if files %}
@@ -32,7 +30,7 @@
3230
{{ file.path }}
3331
</td>
3432
<td>
35-
{{ _self.bytesToSize(file.size) }}
33+
{{- _self.bytesToSize(file.size) -}}
3634
</td>
3735

3836
<td>

src/CoreBundle/Resources/views/Breadcrumb/breadcrumb_legacy.html.twig

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
{#{% endblock %}#}
99

1010
{#{% block list %}#}
11-
{# {% apply spaceless %}#}
12-
{# <nav aria-label="breadcrumb">#}
13-
{# {{ parent() }}#}
14-
{# </nav>#}
15-
{# {% endapply %}#}
11+
{# <nav aria-label="breadcrumb">#}
12+
{# {{ parent() }}#}
13+
{# </nav>#}
1614
{#{% endblock%}#}

src/CoreBundle/Resources/views/Editor/grid.html.twig

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,21 @@
1010
<div class="grid-tools">
1111
{% for row in grid.rows %}
1212
{% set last_row = loop.last %}
13-
{% spaceless %}
14-
{% set gridColumns %}
15-
{% for column in grid.columns %}
16-
{% if column.visible(grid.isReadyForExport) %}
17-
<div class="items-tools {{ column.renderBlockId }} ">
18-
<div class="tools mt-3 mb-3">
19-
{# {% if column.align != 'left'%} align-{{ column.align }}{% endif %}#}
20-
{# {% if loop.last %} last-column{% endif %}#}
21-
{# {% if last_row %} last-row{% endif %}#}
22-
{{ grid_cell(column, row, grid)|raw }}
23-
</div>
13+
{% set gridColumns %}
14+
{% for column in grid.columns %}
15+
{% if column.visible(grid.isReadyForExport) %}
16+
<div class="items-tools {{ column.renderBlockId }} ">
17+
<div class="tools mt-3 mb-3">
18+
{# {% if column.align != 'left'%} align-{{ column.align }}{% endif %}#}
19+
{# {% if loop.last %} last-column{% endif %}#}
20+
{# {% if last_row %} last-row{% endif %}#}
21+
{{ grid_cell(column, row, grid)|raw }}
2422
</div>
25-
{% endif %}
26-
{% endfor %}
27-
{% endset %}
28-
{{ gridColumns }}
29-
{% endspaceless %}
23+
</div>
24+
{% endif %}
25+
{% endfor %}
26+
{% endset %}
27+
{{~ gridColumns }}
3028
{% endfor %}
3129
</div>
3230
</section>

src/CoreBundle/Resources/views/User/forms.html.twig

Lines changed: 52 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -11,97 +11,81 @@
1111
{% endblock textarea_widget %}
1212

1313
{% block form_widget_simple %}
14-
{% apply spaceless %}
15-
{% set attr = attr|merge({'class': attr.class|default('') ~ ' form-control'}) %}
16-
{% set type = type|default('text') %}
14+
{% set attr = attr|merge({'class': attr.class|default('') ~ ' form-control'}) %}
15+
{% set type = type|default('text') %}
1716

18-
{% if 'file' == type %}
19-
<span class="btn--primary btn-lg file-overlay"><i
20-
class="icon-folder-open"></i> {{ 'sylius.form.choose_file'|trans }}</span>
21-
{% endif %}
22-
{{ parent() }}
23-
{% endapply %}
17+
{%- if 'file' == type -%}
18+
<span class="btn--primary btn-lg file-overlay"><i
19+
class="icon-folder-open"></i> {{ 'sylius.form.choose_file'|trans }}</span>
20+
{%- endif -%}
21+
{{ parent() }}
2422
{% endblock form_widget_simple %}
2523

2624
{% block form_label %}
27-
{% apply spaceless %}
28-
{% set label_attr = label_attr|merge({'class': label_attr.class|default('col-lg-2') ~ ' control-label'}) %}
29-
{{ parent() }}
30-
{% endapply %}
25+
{% set label_attr = label_attr|merge({'class': label_attr.class|default('col-lg-2') ~ ' control-label'}) %}
26+
{{ parent() }}
3127
{% endblock form_label %}
3228

3329
{% block money_widget %}
34-
{% apply spaceless %}
35-
<div class="input-group">
36-
<span class="input-group-addon">{{ money_pattern|replace({'{{ widget }}': ''}) }}</span>
37-
{{ block('form_widget_simple') }}
38-
</div>
39-
{% endapply %}
30+
<div class="input-group">
31+
<span class="input-group-addon">{{ money_pattern|replace({'{{ widget }}': ''}) }}</span>
32+
{{ block('form_widget_simple') }}
33+
</div>
4034
{% endblock money_widget %}
4135

4236
{% block percent_widget %}
43-
{% apply spaceless %}
44-
<div class="input-group">
45-
<span class="input-group-addon">%</span>
46-
{{ block('form_widget_simple') }}
47-
</div>
48-
{% endapply %}
37+
<div class="input-group">
38+
<span class="input-group-addon">%</span>
39+
{{ block('form_widget_simple') }}
40+
</div>
4941
{% endblock percent_widget %}
5042

5143
{% block datetime_widget %}
52-
{% apply spaceless %}
53-
{% if widget == 'single_text' %}
54-
{{ block('form_widget_simple') }}
55-
{% else %}
56-
<div class="form-group">
57-
{{ form_widget(form.date) }}
58-
{{ form_widget(form.time) }}
59-
</div>
60-
{% endif %}
61-
{% endapply %}
44+
{% if widget == 'single_text' %}
45+
{{ block('form_widget_simple') }}
46+
{% else %}
47+
<div class="form-group">
48+
{{ form_widget(form.date) }}
49+
{{ form_widget(form.time) }}
50+
</div>
51+
{% endif %}
6252
{% endblock datetime_widget %}
6353

6454
{% block date_widget %}
65-
{% apply spaceless %}
66-
{% if widget == 'single_text' %}
67-
{{ block('form_widget_simple') }}
68-
{% else %}
69-
{{ '{{ year }} / {{ month }} / {{ day }}'|replace({
70-
'{{ year }}': form_widget(form.year, {'attr': {'style': 'display: inline; width: 100px;'}}),
71-
'{{ month }}': form_widget(form.month, {'attr': {'style': 'display: inline; width: 100px;'}}),
72-
'{{ day }}': form_widget(form.day, {'attr': {'style': 'display: inline; width: 100px;'}}),
73-
})|raw }}
74-
{% endif %}
75-
{% endapply %}
55+
{% if widget == 'single_text' %}
56+
{{ block('form_widget_simple') }}
57+
{% else %}
58+
{{ '{{ year }} / {{ month }} / {{ day }}'|replace({
59+
'{{ year }}': form_widget(form.year, {'attr': {'style': 'display: inline; width: 100px;'}}),
60+
'{{ month }}': form_widget(form.month, {'attr': {'style': 'display: inline; width: 100px;'}}),
61+
'{{ day }}': form_widget(form.day, {'attr': {'style': 'display: inline; width: 100px;'}}),
62+
})|raw }}
63+
{% endif %}
7664
{% endblock date_widget %}
7765

7866
{% block time_widget %}
79-
{% apply spaceless %}
80-
{% if widget == 'single_text' %}
81-
{{ block('form_widget_simple') }}
82-
{% else %}
83-
{% set vars = widget == 'text' ? { 'attr': { 'size': 1, 'style': 'width: 60px; display: inline;' }} : {} %}
84-
&nbsp;{{ form_widget(form.hour, vars) }}{% if with_minutes %}:{{ form_widget(form.minute, vars) }}{% endif %}{% if with_seconds %} {{ form_widget(form.second, vars) }}{% endif %}
85-
{% endif %}
86-
{% endapply %}
67+
{% if widget == 'single_text' %}
68+
{{ block('form_widget_simple') }}
69+
{% else %}
70+
{% set vars = widget == 'text' ? { 'attr': { 'size': 1, 'style': 'width: 60px; display: inline;' }} : {} %}
71+
&nbsp;{{ form_widget(form.hour, vars) }}{% if with_minutes %}:{{ form_widget(form.minute, vars) }}{% endif %}{% if with_seconds %} {{ form_widget(form.second, vars) }}{% endif %}
72+
{% endif %}
8773
{% endblock time_widget %}
8874

8975
{% block form_row %}
90-
{% apply spaceless %}
91-
<div class="form-group{% if errors|length > 0 %} has-error{% endif %}">
92-
{{ form_label(form) }}
93-
<div class="col-lg-10">
94-
{{ form_widget(form) }}
95-
{% for error in errors %}
96-
<span class="help-block form-error">
97-
{{ error.messagePluralization is null
98-
? error.messageTemplate|trans(error.messageParameters, 'validators')
99-
: error.messageTemplate|transchoice(error.messagePluralization, error.messageParameters, 'validators') }}
100-
</span>
101-
{% endfor %}
102-
</div>
76+
<div class="form-group{% if errors|length > 0 %} has-error{% endif %}">
77+
{{ form_label(form) }}
78+
<div class="col-lg-10">
79+
{{ form_widget(form) }}
80+
{% for error in errors %}
81+
<span class="help-block form-error">
82+
{{ error.messagePluralization is null
83+
? error.messageTemplate|trans(error.messageParameters, 'validators')
84+
: error.messageTemplate|transchoice(error.messagePluralization, error.messageParameters, 'validators') }}
85+
</span>
86+
{% endfor %}
10387
</div>
104-
{% endapply %}
88+
</div>
10589
{% endblock form_row %}
10690

10791
{% block sonata_media_type_widget %}

0 commit comments

Comments
 (0)