Skip to content

Commit ceb48e8

Browse files
author
Callin Mullaney
committed
chore: reformat add_attributes being set in twig templates
1 parent b4ba895 commit ceb48e8

43 files changed

Lines changed: 300 additions & 103 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

templates/admin/admin-block-content.html.twig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@
2222
compact ? 'compact',
2323
]
2424
%}
25+
{% set admin_block_content_attributes = {
26+
class: classes,
27+
} %}
2528
{% if content %}
26-
<dl{{ add_attributes({ class: classes }) }}>
29+
<dl{{ add_attributes(admin_block_content_attributes) }}>
2730
{% for item in content %}
2831
<dt class="list-group__link">{{ item.link }}</dt>
2932
{% if item.description %}

templates/admin/admin-block.html.twig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
'panel',
1919
]
2020
%}
21-
<div{{ add_attributes({ class: classes }) }}>
21+
{% set admin_block_attributes = {
22+
class: classes,
23+
} %}
24+
<div{{ add_attributes(admin_block_attributes) }}>
2225
{% if block.title %}
2326
<h3 class="panel__title">{{ block.title }}</h3>
2427
{% endif %}

templates/admin/authorize-report.html.twig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@
1717
* @see https://www.drupal.org/node/3522119
1818
*/
1919
#}
20+
{% set authorize_report_attributes = {
21+
class: 'authorize-results',
22+
} %}
2023
{% if messages %}
21-
<div{{ add_attributes({ class: 'authorize-results' }) }}>
24+
<div{{ add_attributes(authorize_report_attributes) }}>
2225
{% for message_group in messages %}
2326
{{ message_group }}
2427
{% endfor %}

templates/admin/form-element--new-storage-type.html.twig

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@
2424
variant ? variant ~ '__item'
2525
]
2626
%}
27-
<div{{ add_attributes({ class: classes }) }}>
27+
{% set new_storage_type_attributes = {
28+
class: classes,
29+
} %}
30+
<div{{ add_attributes(new_storage_type_attributes) }}>
2831
{% if variant == 'field-option' %}
2932
{{ label }}
3033
<div{{ description.attributes }}>
@@ -35,7 +38,10 @@
3538
{% if variant == 'field-suboption' %}
3639
{{ label }}
3740
{% with { attributes: description.attributes } %}
38-
<div{{ add_attributes({ class: description_classes }) }}>
41+
{% set new_storage_type_description_attributes = {
42+
class: description_classes|default([]),
43+
} %}
44+
<div{{ add_attributes(new_storage_type_description_attributes) }}>
3945
{{ description.content }}
4046
</div>
4147
{% endwith %}

templates/admin/language-negotiation-configure-form.html.twig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@
2929
]
3030
%}
3131
{% with { attributes: language_type.attributes } %}
32-
<div{{ add_attributes({ class: language_classes }) }}>
32+
{% set language_type_wrapper_attributes = {
33+
class: language_classes,
34+
} %}
35+
<div{{ add_attributes(language_type_wrapper_attributes) }}>
3336
<h2>{{ language_type.title }}</h2>
3437
<div class="description">{{ language_type.description }}</div>
3538
{{ language_type.configurable }}

templates/admin/system-modules-details.html.twig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@
3434
{% for module in modules %}
3535
{% set zebra = cycle(['odd', 'even'], loop.index0) %}
3636
{% with { attributes: module.attributes } %}
37-
<tr{{ add_attributes({ class: zebra }) }}>
37+
{% set module_row_attributes = {
38+
class: zebra,
39+
} %}
40+
<tr{{ add_attributes(module_row_attributes) }}>
3841
<td class="checkbox">
3942
{{ module.checkbox }}
4043
</td>

templates/admin/system-modules-uninstall.html.twig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@
3333
{% for module in modules %}
3434
{% set zebra = cycle(['odd', 'even'], loop.index0) -%}
3535
{% with { attributes: module.attributes } %}
36-
<tr{{ add_attributes({ class: zebra }) }}>
36+
{% set module_row_attributes = {
37+
class: zebra,
38+
} %}
39+
<tr{{ add_attributes(module_row_attributes) }}>
3740
<td align="center">
3841
{{- module.checkbox -}}
3942
</td>

templates/admin/system-themes-page.html.twig

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@
3838
]
3939
%}
4040
{% with { attributes: theme_group.attributes } %}
41-
<div{{ add_attributes({ class: theme_group_classes }) }}>
41+
{% set theme_group_wrapper_attributes = {
42+
class: theme_group_classes,
43+
} %}
44+
<div{{ add_attributes(theme_group_wrapper_attributes) }}>
4245
<h2 class="system-themes-list__header">{{ theme_group.title }}</h2>
4346
{% for theme in theme_group.themes %}
4447
{%
@@ -50,7 +53,10 @@
5053
]
5154
%}
5255
{% with { attributes: theme.attributes } %}
53-
<div{{ add_attributes({ class: theme_classes }) }}>
56+
{% set theme_wrapper_attributes = {
57+
class: theme_classes,
58+
} %}
59+
<div{{ add_attributes(theme_wrapper_attributes) }}>
5460
{% if theme.screenshot %}
5561
{{ theme.screenshot }}
5662
{% endif %}

templates/admin/tablesort-indicator.html.twig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
'tablesort--' ~ style,
1414
]
1515
%}
16-
<span{{ add_attributes({ class: classes }) }}>
16+
{% set tablesort_indicator_attributes = {
17+
class: classes,
18+
} %}
19+
<span{{ add_attributes(tablesort_indicator_attributes) }}>
1720
<span class="visually-hidden">
1821
{% if style == 'asc' -%}
1922
{{ 'Sort ascending'|t }}

templates/admin/update-project-status.html.twig

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@
3535
]
3636
%}
3737
{% with { attributes: status.attributes } %}
38-
<div{{ add_attributes({ class: ['project-update__status', status_classes] }) }}>
38+
{% set project_status_attributes = {
39+
class: ['project-update__status', status_classes],
40+
} %}
41+
<div{{ add_attributes(project_status_attributes) }}>
3942
{%- if status.label -%}
4043
<span>{{ status.label }}</span>
4144
{%- else -%}
@@ -77,7 +80,10 @@
7780
<div class="extra">
7881
{% for extra in extras %}
7982
{% with { attributes: extra.attributes } %}
80-
<div{{ add_attributes({ class: extra_classes }) }}>
83+
{% set project_extra_attributes = {
84+
class: extra_classes,
85+
} %}
86+
<div{{ add_attributes(project_extra_attributes) }}>
8187
{{ extra.label }}: {{ extra.data }}
8288
</div>
8389
{% endwith %}

0 commit comments

Comments
 (0)