Commit d81f06f8 authored by alexpott's avatar alexpott

Issue #2326423 by wheatpenny: Move "region" classes from preprocess to template.

parent 94201c5d
...@@ -2046,9 +2046,6 @@ function template_preprocess_region(&$variables) { ...@@ -2046,9 +2046,6 @@ function template_preprocess_region(&$variables) {
// Create the $content variable that templates expect. // Create the $content variable that templates expect.
$variables['content'] = $variables['elements']['#children']; $variables['content'] = $variables['elements']['#children'];
$variables['region'] = $variables['elements']['#region']; $variables['region'] = $variables['elements']['#region'];
$variables['attributes']['class'][] = 'region';
$variables['attributes']['class'][] = drupal_html_class('region-' . $variables['region']);
} }
/** /**
......
...@@ -5,13 +5,7 @@ ...@@ -5,13 +5,7 @@
* *
* Available variables: * Available variables:
* - content: The content for this region, typically blocks. * - content: The content for this region, typically blocks.
* - attributes: HTML attributes for the region div, including: * - attributes: HTML attributes for the region div.
* - 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.
* - region: The name of the region variable as defined in the theme's * - region: The name of the region variable as defined in the theme's
* .info.yml file. * .info.yml file.
* *
...@@ -20,8 +14,14 @@ ...@@ -20,8 +14,14 @@
* @ingroup themeable * @ingroup themeable
*/ */
#} #}
{%
set classes = [
'region',
'region-' ~ region|clean_class,
]
%}
{% if content %} {% if content %}
<div{{ attributes }}> <div{{ attributes.addClass(classes) }}>
{{ content }} {{ content }}
</div> </div>
{% endif %} {% endif %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment