function template_preprocess_region

Same name in other branches
  1. 9 core/includes/theme.inc \template_preprocess_region()
  2. 8.9.x core/includes/theme.inc \template_preprocess_region()
  3. 10 core/includes/theme.inc \template_preprocess_region()
  4. 11.x core/includes/theme.inc \template_preprocess_region()

Preprocess variables for region.tpl.php

Prepares 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 also

drupal_region_class()

region.tpl.php

File

includes/theme.inc, line 2969

Code

function template_preprocess_region(&$variables) {
    // Create the $content variable that templates expect.
    $variables['content'] = $variables['elements']['#children'];
    $variables['region'] = $variables['elements']['#region'];
    $variables['classes_array'][] = drupal_region_class($variables['region']);
    $variables['theme_hook_suggestions'][] = 'region__' . $variables['region'];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.