summaryrefslogtreecommitdiff
path: root/includes/theme.inc
diff options
context:
space:
mode:
Diffstat (limited to 'includes/theme.inc')
-rw-r--r--includes/theme.inc19
1 files changed, 19 insertions, 0 deletions
diff --git a/includes/theme.inc b/includes/theme.inc
index 73fdf8575..20571c178 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -2404,3 +2404,22 @@ function template_preprocess_maintenance_page(&$variables) {
$variables['template_file'] = 'maintenance-page-offline';
}
}
+
+/**
+ * Preprocess variables for region.tpl.php
+ *
+ * Prepare the values passed to the theme_region function to be passed into a
+ * pluggable template engine. Uses the region name to generate a template file
+ * suggestions. If none are found, the default region.tpl.php is used.
+ *
+ * @see region.tpl.php
+ */
+function template_preprocess_region(&$variables) {
+ // Create the $content variable that templates expect.
+ $variables['content'] = $variables['elements']['#children'];
+ $variables['region'] = $variables['elements']['#region'];
+
+ $region = 'region-' . str_replace('_', '-', $variables['region']);
+ $variables['classes_array'][] = $region;
+ $variables['template_files'][] = $region;
+}