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

8.0.x
Alex Pott 2014-09-10 10:45:53 +01:00
parent 94201c5dd1
commit d81f06f874
2 changed files with 8 additions and 11 deletions

View File

@ -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']);
}
/**

View File

@ -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 %}