function template_preprocess_region

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

Prepares variables for region templates.

Default template: region.html.twig.

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.

Parameters

array $variables: An associative array containing:

  • elements: An associative array containing properties of the region.

File

core/includes/theme.inc, line 1535

Code

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

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