My site theme includes customised templates for 4 regions in the footer, all containing identical code:
set classes = [
'region',
'region-' ~ region|clean_class,
'col-sm-12',
'col-md-6',
'col-lg-3',
]
%}
{% if content %}
<section{{ attributes.addClass(classes) }}>
{{ content }}
</section>
{% endif %}
However, the HTML it produces varies.
In the first two regions, the class row
is being inserted - despite it not appearing in the classes
array:
<!-- BEGIN OUTPUT from 'themes/custom/my_theme/templates/layout/region--footer-first.html.twig' -->
<section class="row region region-footer-first col-sm-12 col-md-6 col-lg-3">
In the last 2 regions, the row
class is missing - which is the correct code I want:
<!-- BEGIN OUTPUT from 'themes/custom/my_theme/templates/layout/region--footer-third.html.twig' -->
<section class="region region-footer-first col-sm-12 col-md-6 col-lg-3">
I can't figure out where it's coming from, so my workaround is to include an additional step that removes the class, in the first two region templates only:
<section{{ attributes.addClass(classes).removeClass('row') }}>
This gives the result I want, but I'm still not sure where the row
class comes from and why it was being applied inconsistently??