In meiner tl_content gibt es Spalten, die die Breite des Contents sowie padding und margin nach oben und unten steuern sollen.
Um diese ALLEN Content Elementen in die Wrapper Klasse zu schreiben, kann man _base.html.twig wie folgt erweitern:
Achtung: Zumindest in Contao 5.3.17 gibt es einen Bug, der das Template nicht erkennt, wenn es innerhalb eines Themes liegt.PHP-Code:
{% extends "@Contao/content_element/_base.html.twig" %}
{% block attributes %}
{% set attributes = attrs()
.mergeWith(attributes|default)
%}
{% if data.marginTop is not empty %}
{% set attributes = attributes.addClass('u-margin-vertical-top u-margin-vertical-top--' ~ data.marginTop) %}
{% endif %}
{% if data.marginBottom is not empty %}
{% set attributes = attributes.addClass('u-margin-vertical-bottom u-margin-vertical-bottom--' ~ data.marginBottom) %}
{% endif %}
{% if data.contentWidth is not empty %}
{% set attributes = attributes.addClass(data.contentWidth) %}
{% endif %}
{% if data.paddingTop is not empty %}
{% set attributes = attributes.addClass('u-padding-vertical-top u-padding-vertical-top--' ~ data.paddingTop) %}
{% endif %}
{% if data.paddingBottom is not empty %}
{% set attributes = attributes.addClass('u-padding-vertical-bottom u-padding-vertical-bottom--' ~ data.paddingBottom) %}
{% endif %}
{{ parent() }}
{% endblock %}