function ThemePreprocess::preprocessRegion
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/
lib/ Drupal/ Core/ Theme/ ThemePreprocess.php, line 431
Class
- ThemePreprocess
- Preprocess for common/core theme templates.
Namespace
Drupal\Core\ThemeCode
public function preprocessRegion(array &$variables) : void {
// 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.