diff options
author | nod_ <nod_@598310.no-reply.drupal.org> | 2024-12-05 11:42:09 +0100 |
---|---|---|
committer | nod_ <nod_@598310.no-reply.drupal.org> | 2024-12-05 11:42:09 +0100 |
commit | 69dc12e1babbacb611836060f1a4576b0731f11c (patch) | |
tree | 97e5a0f686e67e7d1d6e3adc64aafa5c739dbc8a | |
parent | f4f0b14bf9e0fe002d7e4a8be25e87dd30467117 (diff) | |
download | drupal-69dc12e1babbacb611836060f1a4576b0731f11c.tar.gz drupal-69dc12e1babbacb611836060f1a4576b0731f11c.zip |
Issue #3486170 by godotislate, bbrala, finnsky, longwave: Remove use of deprecated "spaceless" filter in core templates
34 files changed, 235 insertions, 307 deletions
diff --git a/core/.deprecation-ignore.txt b/core/.deprecation-ignore.txt index 8bf5c29373cc..96678ba7873f 100644 --- a/core/.deprecation-ignore.txt +++ b/core/.deprecation-ignore.txt @@ -29,9 +29,6 @@ # PHPUnit 10. %The "PHPUnit\\Framework\\TestCase::__construct\(\)" method is considered internal.*You should not extend it from "Drupal\\[^"]+"% -# Twig 3. -%Since twig/twig 3.12: Twig Filter "spaceless" is deprecated% - # Symfony 7.2 %Since symfony/http-foundation 7.2: NativeSessionStorage's "sid_length" option is deprecated and will be ignored in Symfony 8.0.% %Since symfony/http-foundation 7.2: NativeSessionStorage's "sid_bits_per_character" option is deprecated and will be ignored in Symfony 8.0.% diff --git a/core/modules/block_content/templates/block-content-add-list.html.twig b/core/modules/block_content/templates/block-content-add-list.html.twig index a512228cc514..cc34daf318be 100644 --- a/core/modules/block_content/templates/block-content-add-list.html.twig +++ b/core/modules/block_content/templates/block-content-add-list.html.twig @@ -14,11 +14,9 @@ * @ingroup themeable */ #} -{% apply spaceless %} - <dl> - {% for type in types %} - <dt>{{ type.link }}</dt> - <dd>{{ type.description }}</dd> - {% endfor %} - </dl> -{% endapply %} +<dl> + {% for type in types %} + <dt>{{ type.link }}</dt> + <dd>{{ type.description }}</dd> + {% endfor %} +</dl> diff --git a/core/modules/ckeditor5/templates/ckeditor5-settings-toolbar.html.twig b/core/modules/ckeditor5/templates/ckeditor5-settings-toolbar.html.twig index 6ab2cf974e4d..3eda5f9245d4 100644 --- a/core/modules/ckeditor5/templates/ckeditor5-settings-toolbar.html.twig +++ b/core/modules/ckeditor5/templates/ckeditor5-settings-toolbar.html.twig @@ -10,17 +10,15 @@ * supported because the UI can change at any point. */ #} -{% apply spaceless %} - <fieldset aria-labelledby="ckeditor5-toolbar-configuration" aria-describedby="ckeditor5-toolbar-description"> - <legend id="ckeditor5-toolbar-configuration">{{ 'Toolbar configuration'|t }}</legend> - <div class="fieldset-wrapper"> - <div id="ckeditor5-toolbar-description" class="fieldset-description"> - {%- trans -%} - 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. - {%- endtrans -%} - </div> - <div id="ckeditor5-toolbar-app"></div> - {{ form }} +<fieldset aria-labelledby="ckeditor5-toolbar-configuration" aria-describedby="ckeditor5-toolbar-description"> + <legend id="ckeditor5-toolbar-configuration">{{ 'Toolbar configuration'|t }}</legend> + <div class="fieldset-wrapper"> + <div id="ckeditor5-toolbar-description" class="fieldset-description"> + {%- trans -%} + 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. + {%- endtrans -%} </div> - </fieldset> -{% endapply %} + <div id="ckeditor5-toolbar-app"></div> + {{ form }} + </div> +</fieldset> diff --git a/core/modules/link/templates/link-formatter-link-separate.html.twig b/core/modules/link/templates/link-formatter-link-separate.html.twig index 932aae8ba91b..87c057c2ecd9 100644 --- a/core/modules/link/templates/link-formatter-link-separate.html.twig +++ b/core/modules/link/templates/link-formatter-link-separate.html.twig @@ -14,7 +14,5 @@ * @ingroup themeable */ #} -{% apply spaceless %} - {{ title }} - {{ link }} -{% endapply %} +{{~ title ~}} +{{~ link ~}} diff --git a/core/modules/link/tests/src/Functional/LinkFieldTest.php b/core/modules/link/tests/src/Functional/LinkFieldTest.php index 8e28ab4a5933..0880a73ed04b 100644 --- a/core/modules/link/tests/src/Functional/LinkFieldTest.php +++ b/core/modules/link/tests/src/Functional/LinkFieldTest.php @@ -813,7 +813,7 @@ class LinkFieldTest extends BrowserTestBase { $url_title = isset($new_value) ? Unicode::truncate($url, $new_value, FALSE, TRUE) : $url; $expected = '<div class="link-item">'; $expected .= '<div class="link-url"><a href="' . Html::escape($url) . '">' . Html::escape($url_title) . '</a></div>'; - $expected .= '</div>'; + $expected .= PHP_EOL . '</div>'; $this->assertStringContainsString($expected, $output); $url = $url2; @@ -822,7 +822,7 @@ class LinkFieldTest extends BrowserTestBase { $expected = '<div class="link-item">'; $expected .= '<div class="link-title">' . Html::escape($title) . '</div>'; $expected .= '<div class="link-url"><a href="' . Html::escape($url) . '">' . Html::escape($url_title) . '</a></div>'; - $expected .= '</div>'; + $expected .= PHP_EOL . '</div>'; $this->assertStringContainsString($expected, $output); $url = $url3; @@ -831,7 +831,7 @@ class LinkFieldTest extends BrowserTestBase { $expected = '<div class="link-item">'; $expected .= '<div class="link-title">' . Html::escape($title) . '</div>'; $expected .= '<div class="link-url"><a href="' . Html::escape($url) . '">' . Html::escape($url_title) . '</a></div>'; - $expected .= '</div>'; + $expected .= PHP_EOL . '</div>'; $this->assertStringContainsString($expected, $output); break; diff --git a/core/modules/link/tests/themes/link_test_theme/templates/link-formatter-link-separate.html.twig b/core/modules/link/tests/themes/link_test_theme/templates/link-formatter-link-separate.html.twig index 52c8d29a77fc..78547ba86ce9 100644 --- a/core/modules/link/tests/themes/link_test_theme/templates/link-formatter-link-separate.html.twig +++ b/core/modules/link/tests/themes/link_test_theme/templates/link-formatter-link-separate.html.twig @@ -12,11 +12,9 @@ * @see template_preprocess_link_formatter_link_separate() */ #} -{% apply spaceless %} - <div class="link-item"> - {% if title %} - <div class="link-title">{{ title }}</div> - {% endif %} - <div class="link-url">{{ link }}</div> - </div> -{% endapply %} +<div class="link-item"> + {%- if title -%} + <div class="link-title">{{- title -}}</div> + {%- endif -%} + <div class="link-url">{{- link -}}</div> +</div> diff --git a/core/modules/system/templates/dropbutton-wrapper.html.twig b/core/modules/system/templates/dropbutton-wrapper.html.twig index 9c87a49f6b8e..5ca26bf819f7 100644 --- a/core/modules/system/templates/dropbutton-wrapper.html.twig +++ b/core/modules/system/templates/dropbutton-wrapper.html.twig @@ -12,11 +12,7 @@ */ #} {% if children %} - {% apply spaceless %} - <div class="dropbutton-wrapper" data-drupal-ajax-container> - <div class="dropbutton-widget"> - {{ children }} - </div> - </div> - {% endapply %} -{% endif %} + <div class="dropbutton-wrapper" data-drupal-ajax-container> + <div class="dropbutton-widget">{{- children -}}</div> + </div> +{%- endif %} diff --git a/core/modules/system/templates/select.html.twig b/core/modules/system/templates/select.html.twig index a86ed97f98e5..75bbea5f4ab5 100644 --- a/core/modules/system/templates/select.html.twig +++ b/core/modules/system/templates/select.html.twig @@ -12,18 +12,16 @@ * @ingroup themeable */ #} -{% apply spaceless %} - <select{{ attributes }}> - {% for option in options %} - {% if option.type == 'optgroup' %} - <optgroup label="{{ option.label }}"> - {% for sub_option in option.options %} - <option value="{{ sub_option.value }}"{{ sub_option.selected ? ' selected="selected"' }}>{{ sub_option.label }}</option> - {% endfor %} - </optgroup> - {% elseif option.type == 'option' %} - <option value="{{ option.value }}"{{ option.selected ? ' selected="selected"' }}>{{ option.label }}</option> - {% endif %} - {% endfor %} - </select> -{% endapply %} +<select{{ attributes }}> + {% for option in options %} + {% if option.type == 'optgroup' %} + <optgroup label="{{ option.label }}"> + {% for sub_option in option.options %} + <option value="{{ sub_option.value }}"{{ sub_option.selected ? ' selected="selected"' }}>{{ sub_option.label }}</option> + {% endfor %} + </optgroup> + {% elseif option.type == 'option' %} + <option value="{{ option.value }}"{{ option.selected ? ' selected="selected"' }}>{{ option.label }}</option> + {% endif %} + {% endfor %} +</select> diff --git a/core/modules/toolbar/templates/toolbar.html.twig b/core/modules/toolbar/templates/toolbar.html.twig index 2315ac4d4797..46678821ed87 100644 --- a/core/modules/toolbar/templates/toolbar.html.twig +++ b/core/modules/toolbar/templates/toolbar.html.twig @@ -29,18 +29,16 @@ {% set tray = trays[key] %} <div{{ tab.attributes.addClass('toolbar-tab') }}> {{ tab.link }} - {% apply spaceless %} - <div{{ tray.attributes }}> - {% if tray.label %} - <nav class="toolbar-lining clearfix" role="navigation" aria-label="{{ tray.label }}"> - <h3 class="toolbar-tray-name visually-hidden">{{ tray.label }}</h3> - {% else %} - <nav class="toolbar-lining clearfix" role="navigation"> - {% endif %} - {{ tray.links }} - </nav> - </div> - {% endapply %} + <div{{ tray.attributes }}> + {% if tray.label %} + <nav class="toolbar-lining clearfix" role="navigation" aria-label="{{ tray.label }}"> + <h3 class="toolbar-tray-name visually-hidden">{{ tray.label }}</h3> + {% else %} + <nav class="toolbar-lining clearfix" role="navigation"> + {% endif %} + {{- tray.links -}} + </nav> + </div> </div> {% endfor %} </nav> diff --git a/core/modules/views/tests/src/Kernel/Plugin/RowRenderCacheTest.php b/core/modules/views/tests/src/Kernel/Plugin/RowRenderCacheTest.php index f5ca6d233b65..2161bc5c5fbe 100644 --- a/core/modules/views/tests/src/Kernel/Plugin/RowRenderCacheTest.php +++ b/core/modules/views/tests/src/Kernel/Plugin/RowRenderCacheTest.php @@ -183,10 +183,10 @@ class RowRenderCacheTest extends ViewsKernelTestBase { $expected = $access ? "<a href=\"$node_url/delete?destination=/\" hreflang=\"en\">delete</a>" : ""; $output = $view->style_plugin->getField($index, 'delete_node'); $this->assertSame($expected, (string) $output); - $expected = $access ? ' <div class="dropbutton-wrapper" data-drupal-ajax-container><div class="dropbutton-widget"><ul class="dropbutton">' . + $expected = $access ? ' <div class="dropbutton-wrapper" data-drupal-ajax-container>' . PHP_EOL . ' <div class="dropbutton-widget"><ul class="dropbutton">' . '<li><a href="' . $node_url . '/edit?destination=/" aria-label="Edit ' . $node->label() . '" hreflang="en">Edit</a></li>' . '<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>' . - '</ul></div></div>' : ''; + '</ul></div>' . PHP_EOL . ' </div>' : ''; $output = $view->style_plugin->getField($index, 'operations'); $this->assertSame($expected, (string) $output); diff --git a/core/profiles/demo_umami/themes/umami/templates/classy/field/link-formatter-link-separate.html.twig b/core/profiles/demo_umami/themes/umami/templates/classy/field/link-formatter-link-separate.html.twig index 52c8d29a77fc..78547ba86ce9 100644 --- a/core/profiles/demo_umami/themes/umami/templates/classy/field/link-formatter-link-separate.html.twig +++ b/core/profiles/demo_umami/themes/umami/templates/classy/field/link-formatter-link-separate.html.twig @@ -12,11 +12,9 @@ * @see template_preprocess_link_formatter_link_separate() */ #} -{% apply spaceless %} - <div class="link-item"> - {% if title %} - <div class="link-title">{{ title }}</div> - {% endif %} - <div class="link-url">{{ link }}</div> - </div> -{% endapply %} +<div class="link-item"> + {%- if title -%} + <div class="link-title">{{- title -}}</div> + {%- endif -%} + <div class="link-url">{{- link -}}</div> +</div> diff --git a/core/profiles/demo_umami/themes/umami/templates/classy/navigation/toolbar.html.twig b/core/profiles/demo_umami/themes/umami/templates/classy/navigation/toolbar.html.twig index 5ef3ffad3a32..aa57aaac3fc9 100644 --- a/core/profiles/demo_umami/themes/umami/templates/classy/navigation/toolbar.html.twig +++ b/core/profiles/demo_umami/themes/umami/templates/classy/navigation/toolbar.html.twig @@ -27,18 +27,16 @@ {% set tray = trays[key] %} <div{{ tab.attributes.addClass('toolbar-tab') }}> {{ tab.link }} - {% apply spaceless %} - <div{{ tray.attributes }}> - {% if tray.label %} - <nav class="toolbar-lining clearfix" role="navigation" aria-label="{{ tray.label }}"> - <h3 class="toolbar-tray-name visually-hidden">{{ tray.label }}</h3> - {% else %} - <nav class="toolbar-lining clearfix" role="navigation"> - {% endif %} - {{ tray.links }} - </nav> - </div> - {% endapply %} + <div{{ tray.attributes }}> + {% if tray.label %} + <nav class="toolbar-lining clearfix" role="navigation" aria-label="{{ tray.label }}"> + <h3 class="toolbar-tray-name visually-hidden">{{ tray.label }}</h3> + {% else %} + <nav class="toolbar-lining clearfix" role="navigation"> + {% endif %} + {{- tray.links -}} + </nav> + </div> </div> {% endfor %} </nav> diff --git a/core/themes/claro/templates/classy/field/link-formatter-link-separate.html.twig b/core/themes/claro/templates/classy/field/link-formatter-link-separate.html.twig index 52c8d29a77fc..78547ba86ce9 100644 --- a/core/themes/claro/templates/classy/field/link-formatter-link-separate.html.twig +++ b/core/themes/claro/templates/classy/field/link-formatter-link-separate.html.twig @@ -12,11 +12,9 @@ * @see template_preprocess_link_formatter_link_separate() */ #} -{% apply spaceless %} - <div class="link-item"> - {% if title %} - <div class="link-title">{{ title }}</div> - {% endif %} - <div class="link-url">{{ link }}</div> - </div> -{% endapply %} +<div class="link-item"> + {%- if title -%} + <div class="link-title">{{- title -}}</div> + {%- endif -%} + <div class="link-url">{{- link -}}</div> +</div> diff --git a/core/themes/claro/templates/classy/navigation/toolbar.html.twig b/core/themes/claro/templates/classy/navigation/toolbar.html.twig index 5ef3ffad3a32..aa57aaac3fc9 100644 --- a/core/themes/claro/templates/classy/navigation/toolbar.html.twig +++ b/core/themes/claro/templates/classy/navigation/toolbar.html.twig @@ -27,18 +27,16 @@ {% set tray = trays[key] %} <div{{ tab.attributes.addClass('toolbar-tab') }}> {{ tab.link }} - {% apply spaceless %} - <div{{ tray.attributes }}> - {% if tray.label %} - <nav class="toolbar-lining clearfix" role="navigation" aria-label="{{ tray.label }}"> - <h3 class="toolbar-tray-name visually-hidden">{{ tray.label }}</h3> - {% else %} - <nav class="toolbar-lining clearfix" role="navigation"> - {% endif %} - {{ tray.links }} - </nav> - </div> - {% endapply %} + <div{{ tray.attributes }}> + {% if tray.label %} + <nav class="toolbar-lining clearfix" role="navigation" aria-label="{{ tray.label }}"> + <h3 class="toolbar-tray-name visually-hidden">{{ tray.label }}</h3> + {% else %} + <nav class="toolbar-lining clearfix" role="navigation"> + {% endif %} + {{- tray.links -}} + </nav> + </div> </div> {% endfor %} </nav> diff --git a/core/themes/claro/templates/form/input.html.twig b/core/themes/claro/templates/form/input.html.twig index 7d618664bd90..9e7650827c12 100644 --- a/core/themes/claro/templates/form/input.html.twig +++ b/core/themes/claro/templates/form/input.html.twig @@ -11,14 +11,11 @@ * @see claro_preprocess_input() */ #} -{% apply spaceless %} {% if autocomplete_message %} <div class="claro-autocomplete"> - <input{{ attributes }}/> - <div class="claro-autocomplete__message hidden" data-drupal-selector="autocomplete-message">{{ autocomplete_message }}</div> + <input{{ attributes }}/><div class="claro-autocomplete__message hidden" data-drupal-selector="autocomplete-message">{{ autocomplete_message }}</div> </div> - {{ children }} + {{- children -}} {% else %} - <input{{ attributes }}/>{{ children }} + <input{{ attributes }}/>{{- children -}} {% endif %} -{% endapply %} diff --git a/core/themes/claro/templates/navigation/toolbar.html.twig b/core/themes/claro/templates/navigation/toolbar.html.twig index e79d42ec2aa6..17c689ab1546 100644 --- a/core/themes/claro/templates/navigation/toolbar.html.twig +++ b/core/themes/claro/templates/navigation/toolbar.html.twig @@ -30,18 +30,16 @@ {% set tray = trays[key] %} <div{{ tab.attributes.addClass('toolbar-tab') }}> {{ tab.link }} - {% apply spaceless %} - <div{{ tray.attributes }}> - {% if tray.label %} - <nav class="toolbar-lining clearfix" role="navigation" aria-label="{{ tray.label }}"> - <h3 class="toolbar-tray-name visually-hidden">{{ tray.label }}</h3> - {% else %} - <nav class="toolbar-lining clearfix" role="navigation"> - {% endif %} - {{ tray.links }} - </nav> - </div> - {% endapply %} + <div{{ tray.attributes }}> + {% if tray.label %} + <nav class="toolbar-lining clearfix" role="navigation" aria-label="{{ tray.label }}"> + <h3 class="toolbar-tray-name visually-hidden">{{ tray.label }}</h3> + {% else %} + <nav class="toolbar-lining clearfix" role="navigation"> + {% endif %} + {{- tray.links -}} + </nav> + </div> </div> {% endfor %} </nav> diff --git a/core/themes/claro/templates/pager.html.twig b/core/themes/claro/templates/pager.html.twig index 4ebb7e37a84e..3b47d51b2079 100644 --- a/core/themes/claro/templates/pager.html.twig +++ b/core/themes/claro/templates/pager.html.twig @@ -41,7 +41,6 @@ <ul class="pager__items js-pager__items"> {# Print first item if we are not on the first page. #} {% if items.first %} - {% apply spaceless %} <li class="pager__item pager__item--action pager__item--first"> <a href="{{ items.first.href }}" title="{{ 'Go to first page'|t }}"{{ items.first.attributes|without('href', 'title').addClass('pager__link', 'pager__link--action-link') }}> <span class="visually-hidden">{{ 'First page'|t }}</span> @@ -50,12 +49,10 @@ </span> </a> </li> - {% endapply %} {% endif %} {# Print previous item if we are not on the first page. #} {% if items.previous %} - {% apply spaceless %} <li class="pager__item pager__item--action pager__item--previous"> <a href="{{ items.previous.href }}" title="{{ 'Go to previous page'|t }}" rel="prev"{{ items.previous.attributes|without('href', 'title', 'rel').addClass('pager__link', 'pager__link--action-link') }}> <span class="visually-hidden">{{ 'Previous page'|t }}</span> @@ -64,7 +61,6 @@ </span> </a> </li> - {% endapply %} {% endif %} {# Add an ellipsis if there are further previous pages. #} @@ -74,7 +70,6 @@ {# Now generate the actual pager piece. #} {% for key, item in items.pages %} - {% apply spaceless %} <li class="pager__item{{ current == key ? ' pager__item--active' : '' }} pager__item--number"> {% if current == key %} {% set title = 'Current page'|t %} @@ -88,7 +83,6 @@ {{ key }} </a> </li> - {% endapply %} {% endfor %} {# Add an ellipsis if there are further next pages. #} @@ -98,7 +92,6 @@ {# Print next item if we are not on the last page. #} {% if items.next %} - {% apply spaceless %} <li class="pager__item pager__item--action pager__item--next"> <a href="{{ items.next.href }}" title="{{ 'Go to next page'|t }}" rel="next"{{ items.next.attributes|without('href', 'title', 'rel').addClass('pager__link', 'pager__link--action-link') }}> <span class="visually-hidden">{{ 'Next page'|t }}</span> @@ -107,12 +100,10 @@ </span> </a> </li> - {% endapply %} {% endif %} {# Print last item if we are not on the last page. #} {% if items.last %} - {% apply spaceless %} <li class="pager__item pager__item--action pager__item--last"> <a href="{{ items.last.href }}" title="{{ 'Go to last page'|t }}"{{ items.last.attributes|without('href', 'title').addClass('pager__link', 'pager__link--action-link') }}> <span class="visually-hidden">{{ 'Last page'|t }}</span> @@ -121,7 +112,6 @@ </span> </a> </li> - {% endapply %} {% endif %} </ul> </nav> diff --git a/core/themes/claro/templates/views/views-mini-pager.html.twig b/core/themes/claro/templates/views/views-mini-pager.html.twig index 1afc4f463ada..a6fd87b5b992 100644 --- a/core/themes/claro/templates/views/views-mini-pager.html.twig +++ b/core/themes/claro/templates/views/views-mini-pager.html.twig @@ -23,13 +23,11 @@ <{{ pagination_heading_level }} id="{{ heading_id }}" class="visually-hidden">{{ 'Pagination'|t }}</{{ pagination_heading_level }}> <ul{{ content_attributes.addClass('pager__items', 'js-pager__items') }}> {% if items.previous %} - {% apply spaceless %} - <li class="pager__item pager__item--mini pager__item--action pager__item--previous"> - <a{{ items.previous.attributes.addClass(pager_action_classes).setAttribute('title', 'Go to previous page'|t).setAttribute('href', items.previous.href) }}> - <span class="visually-hidden">{{ 'Previous page'|t }}</span> - </a> - </li> - {% endapply %} + <li class="pager__item pager__item--mini pager__item--action pager__item--previous"> + <a{{ items.previous.attributes.addClass(pager_action_classes).setAttribute('title', 'Go to previous page'|t).setAttribute('href', items.previous.href) }}> + <span class="visually-hidden">{{ 'Previous page'|t }}</span> + </a> + </li> {% endif %} {% if items.current %} @@ -42,13 +40,11 @@ {% endif %} {% if items.next %} - {% apply spaceless %} - <li class="pager__item pager__item--mini pager__item--action pager__item--next"> - <a{{ items.next.attributes.addClass(pager_action_classes).setAttribute('title', 'Go to next page'|t).setAttribute('href', items.next.href) }}> - <span class="visually-hidden">{{ 'Next page'|t }}</span> - </a> - </li> - {% endapply %} + <li class="pager__item pager__item--mini pager__item--action pager__item--next"> + <a{{ items.next.attributes.addClass(pager_action_classes).setAttribute('title', 'Go to next page'|t).setAttribute('href', items.next.href) }}> + <span class="visually-hidden">{{ 'Next page'|t }}</span> + </a> + </li> {% endif %} </ul> </nav> diff --git a/core/themes/olivero/css/components/node.css b/core/themes/olivero/css/components/node.css index 7cb6311c9758..8a4dae22bb2f 100644 --- a/core/themes/olivero/css/components/node.css +++ b/core/themes/olivero/css/components/node.css @@ -10,6 +10,10 @@ * Node specific styles. */ +.node__author { + display: inline-flex; +} + .node__meta { display: flex; align-items: center; diff --git a/core/themes/olivero/css/components/node.pcss.css b/core/themes/olivero/css/components/node.pcss.css index e9bbf7639e43..109e1cac4d2b 100644 --- a/core/themes/olivero/css/components/node.pcss.css +++ b/core/themes/olivero/css/components/node.pcss.css @@ -5,6 +5,10 @@ @import "../base/media-queries.pcss.css"; +.node__author { + display: inline-flex; +} + .node__meta { display: flex; align-items: center; diff --git a/core/themes/olivero/templates/content/node--teaser.html.twig b/core/themes/olivero/templates/content/node--teaser.html.twig index 40a2c51e4a24..6b3a249bcd80 100644 --- a/core/themes/olivero/templates/content/node--teaser.html.twig +++ b/core/themes/olivero/templates/content/node--teaser.html.twig @@ -95,7 +95,7 @@ {% if display_submitted %} <div class="node__meta"> <span{{ author_attributes }}> - {{ 'By'|t }} {% apply spaceless %}<span class="node__author">{{ author_name }}</span>{% endapply %}, {{ date }} + {{ 'By'|t }} <span class="node__author">{{- author_name -}}</span>, {{ date }} </span> {{ metadata }} </div> diff --git a/core/themes/olivero/templates/content/node.html.twig b/core/themes/olivero/templates/content/node.html.twig index 4af6e2ffb53e..5bf444f9783d 100644 --- a/core/themes/olivero/templates/content/node.html.twig +++ b/core/themes/olivero/templates/content/node.html.twig @@ -90,7 +90,7 @@ </div> {% endif %} <span{{ author_attributes }}> - {{ 'By'|t }} {% apply spaceless %}{{ author_name }}{% endapply %}, {{ date }} + {{ 'By'|t }} <span class="node__author">{{- author_name -}}</span>, {{ date }} </span> {{ metadata }} </div> diff --git a/core/themes/olivero/templates/content/search-result.html.twig b/core/themes/olivero/templates/content/search-result.html.twig index b73d133a4434..6d03236ba21e 100644 --- a/core/themes/olivero/templates/content/search-result.html.twig +++ b/core/themes/olivero/templates/content/search-result.html.twig @@ -60,7 +60,7 @@ <div class="search-result__meta"> {% if info_split.user %} <span> - {{ 'By'|t }} {% apply spaceless %}<span class="search-result__author">{{ info_split.user }}</span>{% endapply %} + {{ 'By'|t }} <span class="search-result__author">{{- info_split.user -}}</span> </span> {% endif %} {% if info_date %} diff --git a/core/themes/olivero/templates/navigation/pager.html.twig b/core/themes/olivero/templates/navigation/pager.html.twig index 2d2a622ac4d2..d4f910bfe176 100644 --- a/core/themes/olivero/templates/navigation/pager.html.twig +++ b/core/themes/olivero/templates/navigation/pager.html.twig @@ -37,26 +37,22 @@ <ul class="pager__items js-pager__items"> {# Print first item if we are not on the first page. #} {% if items.first %} - {% apply spaceless %} - <li class="pager__item pager__item--control pager__item--first"> - <a href="{{ items.first.href }}" title="{{ 'Go to first page'|t }}"{{ items.first.attributes|without('href', 'title').addClass('pager__link') }}> - <span class="visually-hidden">{{ 'First page'|t }}</span> - {% include "@olivero/../images/pager-first.svg" %} - </a> - </li> - {% endapply %} + <li class="pager__item pager__item--control pager__item--first"> + <a href="{{ items.first.href }}" title="{{ 'Go to first page'|t }}"{{ items.first.attributes|without('href', 'title').addClass('pager__link') }}> + <span class="visually-hidden">{{ 'First page'|t }}</span> + {%- include "@olivero/../images/pager-first.svg" -%} + </a> + </li> {% endif %} {# Print previous item if we are not on the first page. #} {% if items.previous %} - {% apply spaceless %} - <li class="pager__item pager__item--control pager__item--previous"> - <a href="{{ items.previous.href }}" title="{{ 'Go to previous page'|t }}" rel="prev"{{ items.previous.attributes|without('href', 'title', 'rel').addClass('pager__link') }}> - <span class="visually-hidden">{{ 'Previous page'|t }}</span> - {% include "@olivero/../images/pager-previous.svg" %} - </a> - </li> - {% endapply %} + <li class="pager__item pager__item--control pager__item--previous"> + <a href="{{ items.previous.href }}" title="{{ 'Go to previous page'|t }}" rel="prev"{{ items.previous.attributes|without('href', 'title', 'rel').addClass('pager__link') }}> + <span class="visually-hidden">{{ 'Previous page'|t }}</span> + {%- include "@olivero/../images/pager-previous.svg" -%} + </a> + </li> {% endif %} {# Add an ellipsis if there are further previous pages. #} @@ -66,25 +62,23 @@ {# Now generate the actual pager piece. #} {% for key, item in items.pages %} - {% apply spaceless %} - <li class="pager__item{{ current == key ? ' pager__item--active' : '' }} pager__item--number"> - {% if current == key %} - {% set title = 'Current page'|t %} - {% else %} - {% set title = 'Go to page @key'|t({'@key': key}) %} - {% endif %} - {% if current != key %} - <a href="{{ item.href }}" title="{{ title }}"{{ item.attributes|without('href', 'title').addClass('pager__link', current == key ? ' is-active') }}> - {% endif %} - <span class="visually-hidden"> - {{ 'Page'|t }} - </span> - {{ key }} - {% if current != key %} - </a> - {% endif %} - </li> - {% endapply %} + <li class="pager__item{{ current == key ? ' pager__item--active' : '' }} pager__item--number"> + {% if current == key %} + {% set title = 'Current page'|t %} + {% else %} + {% set title = 'Go to page @key'|t({'@key': key}) %} + {% endif %} + {% if current != key %} + <a href="{{ item.href }}" title="{{ title }}"{{ item.attributes|without('href', 'title').addClass('pager__link', current == key ? ' is-active') }}> + {% endif %} + <span class="visually-hidden"> + {{ 'Page'|t }} + </span> + {{ key }} + {% if current != key %} + </a> + {% endif %} + </li> {% endfor %} {# Add an ellipsis if there are further next pages. #} @@ -94,26 +88,22 @@ {# Print next item if we are not on the last page. #} {% if items.next %} - {% apply spaceless %} - <li class="pager__item pager__item--control pager__item--next"> - <a href="{{ items.next.href }}" title="{{ 'Go to next page'|t }}" rel="next"{{ items.next.attributes|without('href', 'title', 'rel').addClass('pager__link') }}> - <span class="visually-hidden">{{ 'Next page'|t }}</span> - {% include "@olivero/../images/pager-previous.svg" %} - </a> - </li> - {% endapply %} + <li class="pager__item pager__item--control pager__item--next"> + <a href="{{ items.next.href }}" title="{{ 'Go to next page'|t }}" rel="next"{{ items.next.attributes|without('href', 'title', 'rel').addClass('pager__link') }}> + <span class="visually-hidden">{{ 'Next page'|t }}</span> + {%- include "@olivero/../images/pager-previous.svg" -%} + </a> + </li> {% endif %} {# Print last item if we are not on the last page. #} {% if items.last %} - {% apply spaceless %} - <li class="pager__item pager__item--control pager__item--last"> - <a href="{{ items.last.href }}" title="{{ 'Go to last page'|t }}"{{ items.last.attributes|without('href', 'title').addClass('pager__link') }}> - <span class="visually-hidden">{{ 'Last page'|t }}</span> - {% include "@olivero/../images/pager-first.svg" %} - </a> - </li> - {% endapply %} + <li class="pager__item pager__item--control pager__item--last"> + <a href="{{ items.last.href }}" title="{{ 'Go to last page'|t }}"{{ items.last.attributes|without('href', 'title').addClass('pager__link') }}> + <span class="visually-hidden">{{ 'Last page'|t }}</span> + {%- include "@olivero/../images/pager-first.svg" -%} + </a> + </li> {% endif %} </ul> </nav> diff --git a/core/themes/olivero/templates/user/username.html.twig b/core/themes/olivero/templates/user/username.html.twig index 28eef2ccd761..32f2d440b840 100644 --- a/core/themes/olivero/templates/user/username.html.twig +++ b/core/themes/olivero/templates/user/username.html.twig @@ -24,7 +24,7 @@ * @ingroup themeable */ #} -{% if link_path -%} +{%- if link_path -%} <a{{ attributes }}>{{ name }}{{ extra }}</a> {%- else -%} <span{{ attributes }}>{{ name }}{{ extra }}</span> diff --git a/core/themes/olivero/templates/views/views-mini-pager.html.twig b/core/themes/olivero/templates/views/views-mini-pager.html.twig index a927f84ddae3..b7e4c1f31948 100644 --- a/core/themes/olivero/templates/views/views-mini-pager.html.twig +++ b/core/themes/olivero/templates/views/views-mini-pager.html.twig @@ -17,14 +17,12 @@ <ul class="pager__items js-pager__items"> {# Print previous item if we are not on the first page. #} {% if items.previous %} - {% apply spaceless %} - <li class="pager__item pager__item--control pager__item--previous"> - <a href="{{ items.previous.href }}" class="pager__link" title="{{ 'Go to previous page'|t }}" rel="prev"{{ items.previous.attributes|without('href', 'title', 'rel', 'class') }}> - <span class="visually-hidden">{{ 'Previous page'|t }}</span> - {% include "@olivero/../images/pager-previous.svg" %} - </a> - </li> - {% endapply %} + <li class="pager__item pager__item--control pager__item--previous"> + <a href="{{ items.previous.href }}" class="pager__link" title="{{ 'Go to previous page'|t }}" rel="prev"{{ items.previous.attributes|without('href', 'title', 'rel', 'class') }}> + <span class="visually-hidden">{{ 'Previous page'|t }}</span> + {%- include "@olivero/../images/pager-previous.svg" -%} + </a> + </li> {% endif %} {# Print current active page. #} @@ -36,14 +34,12 @@ {# Print next item if we are not on the last page. #} {% if items.next %} - {% apply spaceless %} - <li class="pager__item pager__item--control pager__item--next"> - <a href="{{ items.next.href }}" class="pager__link" title="{{ 'Go to next page'|t }}" rel="next"{{ items.next.attributes|without('href', 'title', 'rel') }}> - <span class="visually-hidden">{{ 'Next page'|t }}</span> - {% include "@olivero/../images/pager-previous.svg" %} - </a> - </li> - {% endapply %} + <li class="pager__item pager__item--control pager__item--next"> + <a href="{{ items.next.href }}" class="pager__link" title="{{ 'Go to next page'|t }}" rel="next"{{ items.next.attributes|without('href', 'title', 'rel') }}> + <span class="visually-hidden">{{ 'Next page'|t }}</span> + {%- include "@olivero/../images/pager-previous.svg" -%} + </a> + </li> {% endif %} </ul> </nav> diff --git a/core/themes/stable9/templates/admin/block-content-add-list.html.twig b/core/themes/stable9/templates/admin/block-content-add-list.html.twig index 4c8678d5f0de..b0076f296b16 100644 --- a/core/themes/stable9/templates/admin/block-content-add-list.html.twig +++ b/core/themes/stable9/templates/admin/block-content-add-list.html.twig @@ -12,11 +12,9 @@ * @see template_preprocess_block_content_add_list() */ #} -{% apply spaceless %} - <dl> - {% for type in types %} - <dt>{{ type.link }}</dt> - <dd>{{ type.description }}</dd> - {% endfor %} - </dl> -{% endapply %} +<dl> + {% for type in types %} + <dt>{{ type.link }}</dt> + <dd>{{ type.description }}</dd> + {% endfor %} +</dl> diff --git a/core/themes/stable9/templates/field/link-formatter-link-separate.html.twig b/core/themes/stable9/templates/field/link-formatter-link-separate.html.twig index b75457b412c6..cedba252d1d1 100644 --- a/core/themes/stable9/templates/field/link-formatter-link-separate.html.twig +++ b/core/themes/stable9/templates/field/link-formatter-link-separate.html.twig @@ -12,7 +12,5 @@ * @see template_preprocess_link_formatter_link_separate() */ #} -{% apply spaceless %} - {{ title }} - {{ link }} -{% endapply %} +{{~ title ~}} +{{~ link ~}} diff --git a/core/themes/stable9/templates/form/dropbutton-wrapper.html.twig b/core/themes/stable9/templates/form/dropbutton-wrapper.html.twig index 930e6ef60749..54d6fe4d989a 100644 --- a/core/themes/stable9/templates/form/dropbutton-wrapper.html.twig +++ b/core/themes/stable9/templates/form/dropbutton-wrapper.html.twig @@ -10,11 +10,7 @@ */ #} {% if children %} - {% apply spaceless %} - <div class="dropbutton-wrapper" data-drupal-ajax-container> - <div class="dropbutton-widget"> - {{ children }} - </div> - </div> - {% endapply %} -{% endif %} + <div class="dropbutton-wrapper" data-drupal-ajax-container> + <div class="dropbutton-widget">{{- children -}}</div> + </div> +{%- endif %} diff --git a/core/themes/stable9/templates/form/select.html.twig b/core/themes/stable9/templates/form/select.html.twig index 9c8a97c05897..e493f4ec0821 100644 --- a/core/themes/stable9/templates/form/select.html.twig +++ b/core/themes/stable9/templates/form/select.html.twig @@ -10,18 +10,16 @@ * @see template_preprocess_select() */ #} -{% apply spaceless %} - <select{{ attributes }}> - {% for option in options %} - {% if option.type == 'optgroup' %} - <optgroup label="{{ option.label }}"> - {% for sub_option in option.options %} - <option value="{{ sub_option.value }}"{{ sub_option.selected ? ' selected="selected"' }}>{{ sub_option.label }}</option> - {% endfor %} - </optgroup> - {% elseif option.type == 'option' %} - <option value="{{ option.value }}"{{ option.selected ? ' selected="selected"' }}>{{ option.label }}</option> - {% endif %} - {% endfor %} - </select> -{% endapply %} +<select{{ attributes }}> + {% for option in options %} + {% if option.type == 'optgroup' %} + <optgroup label="{{ option.label }}"> + {% for sub_option in option.options %} + <option value="{{ sub_option.value }}" {{ sub_option.selected ? ' selected="selected"' }}>{{ sub_option.label }}</option> + {% endfor %} + </optgroup> + {% elseif option.type == 'option' %} + <option value="{{ option.value }}" {{ option.selected ? ' selected="selected"' }}>{{ option.label }}</option> + {% endif %} + {% endfor %} +</select> diff --git a/core/themes/stable9/templates/navigation/toolbar.html.twig b/core/themes/stable9/templates/navigation/toolbar.html.twig index 5ef3ffad3a32..aa57aaac3fc9 100644 --- a/core/themes/stable9/templates/navigation/toolbar.html.twig +++ b/core/themes/stable9/templates/navigation/toolbar.html.twig @@ -27,18 +27,16 @@ {% set tray = trays[key] %} <div{{ tab.attributes.addClass('toolbar-tab') }}> {{ tab.link }} - {% apply spaceless %} - <div{{ tray.attributes }}> - {% if tray.label %} - <nav class="toolbar-lining clearfix" role="navigation" aria-label="{{ tray.label }}"> - <h3 class="toolbar-tray-name visually-hidden">{{ tray.label }}</h3> - {% else %} - <nav class="toolbar-lining clearfix" role="navigation"> - {% endif %} - {{ tray.links }} - </nav> - </div> - {% endapply %} + <div{{ tray.attributes }}> + {% if tray.label %} + <nav class="toolbar-lining clearfix" role="navigation" aria-label="{{ tray.label }}"> + <h3 class="toolbar-tray-name visually-hidden">{{ tray.label }}</h3> + {% else %} + <nav class="toolbar-lining clearfix" role="navigation"> + {% endif %} + {{- tray.links -}} + </nav> + </div> </div> {% endfor %} </nav> diff --git a/core/themes/starterkit_theme/templates/field/link-formatter-link-separate.html.twig b/core/themes/starterkit_theme/templates/field/link-formatter-link-separate.html.twig index 52c8d29a77fc..78547ba86ce9 100644 --- a/core/themes/starterkit_theme/templates/field/link-formatter-link-separate.html.twig +++ b/core/themes/starterkit_theme/templates/field/link-formatter-link-separate.html.twig @@ -12,11 +12,9 @@ * @see template_preprocess_link_formatter_link_separate() */ #} -{% apply spaceless %} - <div class="link-item"> - {% if title %} - <div class="link-title">{{ title }}</div> - {% endif %} - <div class="link-url">{{ link }}</div> - </div> -{% endapply %} +<div class="link-item"> + {%- if title -%} + <div class="link-title">{{- title -}}</div> + {%- endif -%} + <div class="link-url">{{- link -}}</div> +</div> diff --git a/core/themes/starterkit_theme/templates/form/dropbutton-wrapper.html.twig b/core/themes/starterkit_theme/templates/form/dropbutton-wrapper.html.twig index 930e6ef60749..54d6fe4d989a 100644 --- a/core/themes/starterkit_theme/templates/form/dropbutton-wrapper.html.twig +++ b/core/themes/starterkit_theme/templates/form/dropbutton-wrapper.html.twig @@ -10,11 +10,7 @@ */ #} {% if children %} - {% apply spaceless %} - <div class="dropbutton-wrapper" data-drupal-ajax-container> - <div class="dropbutton-widget"> - {{ children }} - </div> - </div> - {% endapply %} -{% endif %} + <div class="dropbutton-wrapper" data-drupal-ajax-container> + <div class="dropbutton-widget">{{- children -}}</div> + </div> +{%- endif %} diff --git a/core/themes/starterkit_theme/templates/form/select.html.twig b/core/themes/starterkit_theme/templates/form/select.html.twig index 9c8a97c05897..57b824a3f3e1 100644 --- a/core/themes/starterkit_theme/templates/form/select.html.twig +++ b/core/themes/starterkit_theme/templates/form/select.html.twig @@ -10,18 +10,16 @@ * @see template_preprocess_select() */ #} -{% apply spaceless %} - <select{{ attributes }}> - {% for option in options %} - {% if option.type == 'optgroup' %} - <optgroup label="{{ option.label }}"> - {% for sub_option in option.options %} - <option value="{{ sub_option.value }}"{{ sub_option.selected ? ' selected="selected"' }}>{{ sub_option.label }}</option> - {% endfor %} - </optgroup> - {% elseif option.type == 'option' %} - <option value="{{ option.value }}"{{ option.selected ? ' selected="selected"' }}>{{ option.label }}</option> - {% endif %} - {% endfor %} - </select> -{% endapply %} +<select{{ attributes }}> + {% for option in options %} + {% if option.type == 'optgroup' %} + <optgroup label="{{ option.label }}"> + {% for sub_option in option.options %} + <option value="{{ sub_option.value }}"{{ sub_option.selected ? ' selected="selected"' }}>{{ sub_option.label }}</option> + {% endfor %} + </optgroup> + {% elseif option.type == 'option' %} + <option value="{{ option.value }}"{{ option.selected ? ' selected="selected"' }}>{{ option.label }}</option> + {% endif %} + {% endfor %} +</select> |