class Region

Pre-processes variables for the "region" theme hook.

Plugin annotation



Expanded class hierarchy of Region

Related topics


class Region extends PreprocessBase implements PreprocessInterface {

   * {@inheritdoc}
  public function preprocessVariables(Variables $variables) {
    $region = $variables['elements']['#region'];
    $variables['region'] = $region;
    $variables['content'] = $variables['elements']['#children'];

    // Help region.
    if ($region === 'help' && !empty($variables['content'])) {
      $variables['content'] = [
        'icon' => Bootstrap::glyphicon('question-sign'),
        'content' => ['#markup' => $variables['content']],
      $variables->addClass(['alert', 'alert-info', 'messages', 'info']);

    // Support for "well" classes in regions.
    static $region_wells;
    if (!isset($region_wells)) {
      $region_wells = $this->theme->getSetting('region_wells');
    if (!empty($region_wells[$region])) {



Contains filters are case sensitive
Name Modifiers Type Description
PluginBase::$theme protected property The currently set theme object.
PluginBase::__construct public function
PreprocessBase::$hook protected property The theme hook invoked.
PreprocessBase::$info protected property The theme hook info array from the theme registry.
PreprocessBase::$variables protected property The Variables object.
PreprocessBase::preprocess public function Preprocess theme hook variables. Overrides PreprocessInterface::preprocess
PreprocessBase::preprocessAttributes protected function Ensures all attributes have been converted to an Attribute object.
PreprocessBase::preprocessDescription protected function Converts any set description variable into a traversable array.
PreprocessBase::preprocessElement protected function Preprocess the variables array if an element is present.
Region::preprocessVariables public function Preprocess the variables array. Overrides PreprocessBase::preprocessVariables