From fedf2929451d815e95fdbc323cffacccd797cd6a Mon Sep 17 00:00:00 2001 From: hatuhay <alberto@siles.pe> Date: Sat, 23 Jun 2018 15:53:02 -0500 Subject: [PATCH] Add extra classes to region --- bootstrap_barrio.theme | 14 ++++++++++++-- theme-settings.php | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/bootstrap_barrio.theme b/bootstrap_barrio.theme index 02acb54..aaa24b2 100644 --- a/bootstrap_barrio.theme +++ b/bootstrap_barrio.theme @@ -304,9 +304,19 @@ function bootstrap_barrio_preprocess_node(&$variables) { * Implements hook_preprocess_HOOK() for region.html.twig. */ function bootstrap_barrio_preprocess_region(&$variables) { - // Add a clearfix class to system branding blocks. + $nowrap = [ + 'breadcrumb', + 'content', + 'primary_menu', + 'header', + 'sidebar_first', + 'sidebar_second', + ]; if (theme_get_setting('bootstrap_barrio_region_class_' . $variables['elements']['#region']) !== NULL) { - $variables['region_classes'] = theme_get_setting('bootstrap_barrio_region_class_' . $variables['elements']['#region']); + $variables['attributes']['class'][] = theme_get_setting('bootstrap_barrio_region_class_' . $variables['elements']['#region']); + } + elseif (!in_array($variables['elements']['#region'], $nowrap)) { + $variables['attributes']['class'][] = 'row'; } } diff --git a/theme-settings.php b/theme-settings.php index 380bb11..27ed077 100644 --- a/theme-settings.php +++ b/theme-settings.php @@ -124,7 +124,7 @@ function bootstrap_barrio_form_system_theme_settings_alter(&$form, FormStateInte $form['layout']['region'][$name]['bootstrap_barrio_region_class_' . $name] = array( '#type' => 'textfield', '#title' => t('Classes for @description region', array('@description' => $description)), - '#default_value' => theme_get_setting('bootstrap_barrio_region_class_' . $name), + '#default_value' => $region_class, '#size' => 40, '#maxlength' => 40, ); -- GitLab