- Status changed to Closed: won't fix
about 1 year ago 1:44pm 26 December 2023 - 🇧🇪Belgium swentel
Will leave this as is for now. While it's a good idea of course, I'd rather let developers override them in theme layer, that's what we do mostly.
DS provides layouts and accompanying CSS that may optionally be enabled for a given view mode.
In some cases, those using different CSS may also wish to use different classes. For example, a theme integrating a CSS framework like Bulma or Bootstrap might use classes appropriate to those frameworks.
Currently this can be done at the template level. For example, here's a sample template to add appropriate Bulma-specific classes in a child template:
{% extends "@ds/ds-2col.html.twig" %}
{% set attributes = attributes.addClass('columns') %}
{% set left_attributes = left_attributes.addClass('column') %}
{% set right_attributes = right_attributes.addClass('column') %}
However, the (unneeded) DS classes will also be added, since they're added unconditionally in the DS template.
Use a flag variable, default_region_classes
, that determines whether default classes are added to regions.
This is parallel to the default_row_class
variable passed in core to views style templates. See the stable theme's views-view-unformatted.html.twig
template.
Current code snippet in ds-2col.html.twig
:
<{{ outer_wrapper }}{{ attributes.addClass('ds-2col', 'clearfix') }}>
Proposed revised code snippet:
{%
set classes = default_region_classes ? [
'ds-2col',
'clearfix',
] : []
%}
<{{ outer_wrapper }}{{ attributes.addClass(classes) }}>
How a child template would work with this:
{% extends "@ds/ds-2col.html.twig" %}
{% set attributes = attributes.addClass('columns') %}
{% set left_attributes = left_attributes.addClass('column') %}
{% set right_attributes = right_attributes.addClass('column') %}
{% set default_region_classes = false %}
Closed: won't fix
3.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Will leave this as is for now. While it's a good idea of course, I'd rather let developers override them in theme layer, that's what we do mostly.