4 * Contains \Drupal\bootstrap\Plugin\Preprocess\Region.
7 namespace Drupal\bootstrap\Plugin\Preprocess;
9 use Drupal\bootstrap\Annotation\BootstrapPreprocess;
10 use Drupal\bootstrap\Bootstrap;
11 use Drupal\bootstrap\Utility\Variables;
14 * Pre-processes variables for the "region" theme hook.
16 * @ingroup plugins_preprocess
18 * @BootstrapPreprocess("region")
20 class Region extends PreprocessBase implements PreprocessInterface {
25 public function preprocessVariables(Variables $variables) {
26 $region = $variables['elements']['#region'];
27 $variables['region'] = $region;
28 $variables['content'] = $variables['elements']['#children'];
31 if ($region === 'help' && !empty($variables['content'])) {
32 $variables['content'] = [
33 'icon' => Bootstrap::glyphicon('question-sign'),
34 'content' => ['#markup' => $variables['content']],
36 $variables->addClass(['alert', 'alert-info', 'messages', 'info']);
39 // Support for "well" classes in regions.
41 if (!isset($region_wells)) {
42 $region_wells = $this->theme->getSetting('region_wells');
44 if (!empty($region_wells[$region])) {
45 $variables->addClass($region_wells[$region]);