You are here

public function Region::preprocessVariables in Express 8

Preprocess the variables array.

Parameters

\Drupal\bootstrap\Utility\Variables $variables: The Variables object.

Overrides PreprocessBase::preprocessVariables

File

themes/contrib/bootstrap/src/Plugin/Preprocess/Region.php, line 25
Contains \Drupal\bootstrap\Plugin\Preprocess\Region.

Class

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

Namespace

Drupal\bootstrap\Plugin\Preprocess

Code

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])) {
    $variables
      ->addClass($region_wells[$region]);
  }
}