diff --git a/core/includes/theme.inc b/core/includes/theme.inc index a35ab83a009ab8240b96f2a7d3dd87b047502bf4..592308f38cfcbdb336044dce2f9731b41d3e8323 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -2046,9 +2046,6 @@ function template_preprocess_region(&$variables) { // Create the $content variable that templates expect. $variables['content'] = $variables['elements']['#children']; $variables['region'] = $variables['elements']['#region']; - - $variables['attributes']['class'][] = 'region'; - $variables['attributes']['class'][] = drupal_html_class('region-' . $variables['region']); } /** diff --git a/core/modules/system/templates/region.html.twig b/core/modules/system/templates/region.html.twig index 9213e02b6809dc5f531b6d4e40307ba7ee0b0a2b..b2c547178632b160c94bdfc5d6cbf593e87d8cf5 100644 --- a/core/modules/system/templates/region.html.twig +++ b/core/modules/system/templates/region.html.twig @@ -5,13 +5,7 @@ * * Available variables: * - content: The content for this region, typically blocks. - * - attributes: HTML attributes for the region div, including: - * - class: Classes that can be used to style contextually through CSS, - * including: - * - region: The current template type (also know as "theming hook"). - * - region-[name]: The name of the region with underscores replaced with - * dashes. For example, page_top region would have a region-page-top - * class. + * - attributes: HTML attributes for the region div. * - region: The name of the region variable as defined in the theme's * .info.yml file. * @@ -20,8 +14,14 @@ * @ingroup themeable */ #} +{% + set classes = [ + 'region', + 'region-' ~ region|clean_class, + ] +%} {% if content %} - <div{{ attributes }}> + <div{{ attributes.addClass(classes) }}> {{ content }} </div> {% endif %}