3 namespace Drupal\bootstrap\Plugin\Preprocess;
5 use Drupal\bootstrap\Bootstrap;
6 use Drupal\bootstrap\Utility\Variables;
9 * Pre-processes variables for the "region" theme hook.
11 * @ingroup plugins_preprocess
13 * @BootstrapPreprocess("region")
15 class Region extends PreprocessBase implements PreprocessInterface {
20 public function preprocessVariables(Variables $variables) {
21 $region = $variables['elements']['#region'];
22 $variables['region'] = $region;
23 $variables['content'] = $variables['elements']['#children'];
26 if ($region === 'help' && !empty($variables['content'])) {
27 $variables['content'] = [
28 'icon' => Bootstrap::glyphicon('question-sign'),
29 'content' => ['#markup' => $variables['content']],
31 $variables->addClass(['alert', 'alert-info', 'messages', 'info']);
34 // Support for "well" classes in regions.
36 if (!isset($region_wells)) {
37 $region_wells = $this->theme->getSetting('region_wells');
39 if (!empty($region_wells[$region])) {
40 $variables->addClass($region_wells[$region]);