Skip to content

Commit 154480b

Browse files
author
nod_
committed
Issue #3486170 by godotislate, bbrala, finnsky, longwave: Remove use of deprecated "spaceless" filter in core templates
1 parent 601783f commit 154480b

34 files changed

+235
-307
lines changed

.deprecation-ignore.txt

-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@
2929
# PHPUnit 10.
3030
%The "PHPUnit\\Framework\\TestCase::__construct\(\)" method is considered internal.*You should not extend it from "Drupal\\[^"]+"%
3131

32-
# Twig 3.
33-
%Since twig/twig 3.12: Twig Filter "spaceless" is deprecated%
34-
3532
# Symfony 7.2
3633
%Since symfony/http-foundation 7.2: NativeSessionStorage's "sid_length" option is deprecated and will be ignored in Symfony 8.0.%
3734
%Since symfony/http-foundation 7.2: NativeSessionStorage's "sid_bits_per_character" option is deprecated and will be ignored in Symfony 8.0.%

modules/block_content/templates/block-content-add-list.html.twig

+6-8
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@
1414
* @ingroup themeable
1515
*/
1616
#}
17-
{% apply spaceless %}
18-
<dl>
19-
{% for type in types %}
20-
<dt>{{ type.link }}</dt>
21-
<dd>{{ type.description }}</dd>
22-
{% endfor %}
23-
</dl>
24-
{% endapply %}
17+
<dl>
18+
{% for type in types %}
19+
<dt>{{ type.link }}</dt>
20+
<dd>{{ type.description }}</dd>
21+
{% endfor %}
22+
</dl>

modules/ckeditor5/templates/ckeditor5-settings-toolbar.html.twig

+11-13
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,15 @@
1010
* supported because the UI can change at any point.
1111
*/
1212
#}
13-
{% apply spaceless %}
14-
<fieldset aria-labelledby="ckeditor5-toolbar-configuration" aria-describedby="ckeditor5-toolbar-description">
15-
<legend id="ckeditor5-toolbar-configuration">{{ 'Toolbar configuration'|t }}</legend>
16-
<div class="fieldset-wrapper">
17-
<div id="ckeditor5-toolbar-description" class="fieldset-description">
18-
{%- trans -%}
19-
Move a button into the <em>Active toolbar</em> to enable it, or into the list of <em>Available buttons</em> to disable it. Buttons may be moved with the mouse or keyboard arrow keys.
20-
{%- endtrans -%}
21-
</div>
22-
<div id="ckeditor5-toolbar-app"></div>
23-
{{ form }}
13+
<fieldset aria-labelledby="ckeditor5-toolbar-configuration" aria-describedby="ckeditor5-toolbar-description">
14+
<legend id="ckeditor5-toolbar-configuration">{{ 'Toolbar configuration'|t }}</legend>
15+
<div class="fieldset-wrapper">
16+
<div id="ckeditor5-toolbar-description" class="fieldset-description">
17+
{%- trans -%}
18+
Move a button into the <em>Active toolbar</em> to enable it, or into the list of <em>Available buttons</em> to disable it. Buttons may be moved with the mouse or keyboard arrow keys.
19+
{%- endtrans -%}
2420
</div>
25-
</fieldset>
26-
{% endapply %}
21+
<div id="ckeditor5-toolbar-app"></div>
22+
{{ form }}
23+
</div>
24+
</fieldset>

modules/link/templates/link-formatter-link-separate.html.twig

+2-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,5 @@
1414
* @ingroup themeable
1515
*/
1616
#}
17-
{% apply spaceless %}
18-
{{ title }}
19-
{{ link }}
20-
{% endapply %}
17+
{{~ title ~}}
18+
{{~ link ~}}

modules/link/tests/src/Functional/LinkFieldTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ protected function doTestLinkSeparateFormatter(): void {
813813
$url_title = isset($new_value) ? Unicode::truncate($url, $new_value, FALSE, TRUE) : $url;
814814
$expected = '<div class="link-item">';
815815
$expected .= '<div class="link-url"><a href="' . Html::escape($url) . '">' . Html::escape($url_title) . '</a></div>';
816-
$expected .= '</div>';
816+
$expected .= PHP_EOL . '</div>';
817817
$this->assertStringContainsString($expected, $output);
818818

819819
$url = $url2;
@@ -822,7 +822,7 @@ protected function doTestLinkSeparateFormatter(): void {
822822
$expected = '<div class="link-item">';
823823
$expected .= '<div class="link-title">' . Html::escape($title) . '</div>';
824824
$expected .= '<div class="link-url"><a href="' . Html::escape($url) . '">' . Html::escape($url_title) . '</a></div>';
825-
$expected .= '</div>';
825+
$expected .= PHP_EOL . '</div>';
826826
$this->assertStringContainsString($expected, $output);
827827

828828
$url = $url3;
@@ -831,7 +831,7 @@ protected function doTestLinkSeparateFormatter(): void {
831831
$expected = '<div class="link-item">';
832832
$expected .= '<div class="link-title">' . Html::escape($title) . '</div>';
833833
$expected .= '<div class="link-url"><a href="' . Html::escape($url) . '">' . Html::escape($url_title) . '</a></div>';
834-
$expected .= '</div>';
834+
$expected .= PHP_EOL . '</div>';
835835
$this->assertStringContainsString($expected, $output);
836836
break;
837837

modules/link/tests/themes/link_test_theme/templates/link-formatter-link-separate.html.twig

+6-8
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@
1212
* @see template_preprocess_link_formatter_link_separate()
1313
*/
1414
#}
15-
{% apply spaceless %}
16-
<div class="link-item">
17-
{% if title %}
18-
<div class="link-title">{{ title }}</div>
19-
{% endif %}
20-
<div class="link-url">{{ link }}</div>
21-
</div>
22-
{% endapply %}
15+
<div class="link-item">
16+
{%- if title -%}
17+
<div class="link-title">{{- title -}}</div>
18+
{%- endif -%}
19+
<div class="link-url">{{- link -}}</div>
20+
</div>

modules/system/templates/dropbutton-wrapper.html.twig

+4-8
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,7 @@
1212
*/
1313
#}
1414
{% if children %}
15-
{% apply spaceless %}
16-
<div class="dropbutton-wrapper" data-drupal-ajax-container>
17-
<div class="dropbutton-widget">
18-
{{ children }}
19-
</div>
20-
</div>
21-
{% endapply %}
22-
{% endif %}
15+
<div class="dropbutton-wrapper" data-drupal-ajax-container>
16+
<div class="dropbutton-widget">{{- children -}}</div>
17+
</div>
18+
{%- endif %}

modules/system/templates/select.html.twig

+13-15
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,16 @@
1212
* @ingroup themeable
1313
*/
1414
#}
15-
{% apply spaceless %}
16-
<select{{ attributes }}>
17-
{% for option in options %}
18-
{% if option.type == 'optgroup' %}
19-
<optgroup label="{{ option.label }}">
20-
{% for sub_option in option.options %}
21-
<option value="{{ sub_option.value }}"{{ sub_option.selected ? ' selected="selected"' }}>{{ sub_option.label }}</option>
22-
{% endfor %}
23-
</optgroup>
24-
{% elseif option.type == 'option' %}
25-
<option value="{{ option.value }}"{{ option.selected ? ' selected="selected"' }}>{{ option.label }}</option>
26-
{% endif %}
27-
{% endfor %}
28-
</select>
29-
{% endapply %}
15+
<select{{ attributes }}>
16+
{% for option in options %}
17+
{% if option.type == 'optgroup' %}
18+
<optgroup label="{{ option.label }}">
19+
{% for sub_option in option.options %}
20+
<option value="{{ sub_option.value }}"{{ sub_option.selected ? ' selected="selected"' }}>{{ sub_option.label }}</option>
21+
{% endfor %}
22+
</optgroup>
23+
{% elseif option.type == 'option' %}
24+
<option value="{{ option.value }}"{{ option.selected ? ' selected="selected"' }}>{{ option.label }}</option>
25+
{% endif %}
26+
{% endfor %}
27+
</select>

modules/toolbar/templates/toolbar.html.twig

+10-12
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,16 @@
2929
{% set tray = trays[key] %}
3030
<div{{ tab.attributes.addClass('toolbar-tab') }}>
3131
{{ tab.link }}
32-
{% apply spaceless %}
33-
<div{{ tray.attributes }}>
34-
{% if tray.label %}
35-
<nav class="toolbar-lining clearfix" role="navigation" aria-label="{{ tray.label }}">
36-
<h3 class="toolbar-tray-name visually-hidden">{{ tray.label }}</h3>
37-
{% else %}
38-
<nav class="toolbar-lining clearfix" role="navigation">
39-
{% endif %}
40-
{{ tray.links }}
41-
</nav>
42-
</div>
43-
{% endapply %}
32+
<div{{ tray.attributes }}>
33+
{% if tray.label %}
34+
<nav class="toolbar-lining clearfix" role="navigation" aria-label="{{ tray.label }}">
35+
<h3 class="toolbar-tray-name visually-hidden">{{ tray.label }}</h3>
36+
{% else %}
37+
<nav class="toolbar-lining clearfix" role="navigation">
38+
{% endif %}
39+
{{- tray.links -}}
40+
</nav>
41+
</div>
4442
</div>
4543
{% endfor %}
4644
</nav>

modules/views/tests/src/Kernel/Plugin/RowRenderCacheTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,10 @@ protected function doTestRenderedOutput(AccountInterface $account, $check_cache
183183
$expected = $access ? "<a href=\"$node_url/delete?destination=/\" hreflang=\"en\">delete</a>" : "";
184184
$output = $view->style_plugin->getField($index, 'delete_node');
185185
$this->assertSame($expected, (string) $output);
186-
$expected = $access ? ' <div class="dropbutton-wrapper" data-drupal-ajax-container><div class="dropbutton-widget"><ul class="dropbutton">' .
186+
$expected = $access ? ' <div class="dropbutton-wrapper" data-drupal-ajax-container>' . PHP_EOL . ' <div class="dropbutton-widget"><ul class="dropbutton">' .
187187
'<li><a href="' . $node_url . '/edit?destination=/" aria-label="Edit ' . $node->label() . '" hreflang="en">Edit</a></li>' .
188188
'<li><a href="' . $node_url . '/delete?destination=/" aria-label="Delete ' . $node->label() . '" class="use-ajax" data-dialog-type="modal" data-dialog-options="' . Html::escape(Json::encode(['width' => 880])) . '" hreflang="en">Delete</a></li>' .
189-
'</ul></div></div>' : '';
189+
'</ul></div>' . PHP_EOL . ' </div>' : '';
190190
$output = $view->style_plugin->getField($index, 'operations');
191191
$this->assertSame($expected, (string) $output);
192192

profiles/demo_umami/themes/umami/templates/classy/field/link-formatter-link-separate.html.twig

+6-8
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@
1212
* @see template_preprocess_link_formatter_link_separate()
1313
*/
1414
#}
15-
{% apply spaceless %}
16-
<div class="link-item">
17-
{% if title %}
18-
<div class="link-title">{{ title }}</div>
19-
{% endif %}
20-
<div class="link-url">{{ link }}</div>
21-
</div>
22-
{% endapply %}
15+
<div class="link-item">
16+
{%- if title -%}
17+
<div class="link-title">{{- title -}}</div>
18+
{%- endif -%}
19+
<div class="link-url">{{- link -}}</div>
20+
</div>

profiles/demo_umami/themes/umami/templates/classy/navigation/toolbar.html.twig

+10-12
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,16 @@
2727
{% set tray = trays[key] %}
2828
<div{{ tab.attributes.addClass('toolbar-tab') }}>
2929
{{ tab.link }}
30-
{% apply spaceless %}
31-
<div{{ tray.attributes }}>
32-
{% if tray.label %}
33-
<nav class="toolbar-lining clearfix" role="navigation" aria-label="{{ tray.label }}">
34-
<h3 class="toolbar-tray-name visually-hidden">{{ tray.label }}</h3>
35-
{% else %}
36-
<nav class="toolbar-lining clearfix" role="navigation">
37-
{% endif %}
38-
{{ tray.links }}
39-
</nav>
40-
</div>
41-
{% endapply %}
30+
<div{{ tray.attributes }}>
31+
{% if tray.label %}
32+
<nav class="toolbar-lining clearfix" role="navigation" aria-label="{{ tray.label }}">
33+
<h3 class="toolbar-tray-name visually-hidden">{{ tray.label }}</h3>
34+
{% else %}
35+
<nav class="toolbar-lining clearfix" role="navigation">
36+
{% endif %}
37+
{{- tray.links -}}
38+
</nav>
39+
</div>
4240
</div>
4341
{% endfor %}
4442
</nav>

themes/claro/templates/classy/field/link-formatter-link-separate.html.twig

+6-8
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@
1212
* @see template_preprocess_link_formatter_link_separate()
1313
*/
1414
#}
15-
{% apply spaceless %}
16-
<div class="link-item">
17-
{% if title %}
18-
<div class="link-title">{{ title }}</div>
19-
{% endif %}
20-
<div class="link-url">{{ link }}</div>
21-
</div>
22-
{% endapply %}
15+
<div class="link-item">
16+
{%- if title -%}
17+
<div class="link-title">{{- title -}}</div>
18+
{%- endif -%}
19+
<div class="link-url">{{- link -}}</div>
20+
</div>

themes/claro/templates/classy/navigation/toolbar.html.twig

+10-12
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,16 @@
2727
{% set tray = trays[key] %}
2828
<div{{ tab.attributes.addClass('toolbar-tab') }}>
2929
{{ tab.link }}
30-
{% apply spaceless %}
31-
<div{{ tray.attributes }}>
32-
{% if tray.label %}
33-
<nav class="toolbar-lining clearfix" role="navigation" aria-label="{{ tray.label }}">
34-
<h3 class="toolbar-tray-name visually-hidden">{{ tray.label }}</h3>
35-
{% else %}
36-
<nav class="toolbar-lining clearfix" role="navigation">
37-
{% endif %}
38-
{{ tray.links }}
39-
</nav>
40-
</div>
41-
{% endapply %}
30+
<div{{ tray.attributes }}>
31+
{% if tray.label %}
32+
<nav class="toolbar-lining clearfix" role="navigation" aria-label="{{ tray.label }}">
33+
<h3 class="toolbar-tray-name visually-hidden">{{ tray.label }}</h3>
34+
{% else %}
35+
<nav class="toolbar-lining clearfix" role="navigation">
36+
{% endif %}
37+
{{- tray.links -}}
38+
</nav>
39+
</div>
4240
</div>
4341
{% endfor %}
4442
</nav>

themes/claro/templates/form/input.html.twig

+3-6
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,11 @@
1111
* @see claro_preprocess_input()
1212
*/
1313
#}
14-
{% apply spaceless %}
1514
{% if autocomplete_message %}
1615
<div class="claro-autocomplete">
17-
<input{{ attributes }}/>
18-
<div class="claro-autocomplete__message hidden" data-drupal-selector="autocomplete-message">{{ autocomplete_message }}</div>
16+
<input{{ attributes }}/><div class="claro-autocomplete__message hidden" data-drupal-selector="autocomplete-message">{{ autocomplete_message }}</div>
1917
</div>
20-
{{ children }}
18+
{{- children -}}
2119
{% else %}
22-
<input{{ attributes }}/>{{ children }}
20+
<input{{ attributes }}/>{{- children -}}
2321
{% endif %}
24-
{% endapply %}

themes/claro/templates/navigation/toolbar.html.twig

+10-12
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,16 @@
3030
{% set tray = trays[key] %}
3131
<div{{ tab.attributes.addClass('toolbar-tab') }}>
3232
{{ tab.link }}
33-
{% apply spaceless %}
34-
<div{{ tray.attributes }}>
35-
{% if tray.label %}
36-
<nav class="toolbar-lining clearfix" role="navigation" aria-label="{{ tray.label }}">
37-
<h3 class="toolbar-tray-name visually-hidden">{{ tray.label }}</h3>
38-
{% else %}
39-
<nav class="toolbar-lining clearfix" role="navigation">
40-
{% endif %}
41-
{{ tray.links }}
42-
</nav>
43-
</div>
44-
{% endapply %}
33+
<div{{ tray.attributes }}>
34+
{% if tray.label %}
35+
<nav class="toolbar-lining clearfix" role="navigation" aria-label="{{ tray.label }}">
36+
<h3 class="toolbar-tray-name visually-hidden">{{ tray.label }}</h3>
37+
{% else %}
38+
<nav class="toolbar-lining clearfix" role="navigation">
39+
{% endif %}
40+
{{- tray.links -}}
41+
</nav>
42+
</div>
4543
</div>
4644
{% endfor %}
4745
</nav>

0 commit comments

Comments
 (0)