9d7f0b20a37b316e404937c7180e1fb5ab4af0f2
[yaffs-website] / web / modules / contrib / bootstrap_layouts / src / Plugin / BootstrapLayouts / Updates / BootstrapLayoutsUpdate8402.php
1 <?php
2
3 namespace Drupal\bootstrap_layouts\Plugin\BootstrapLayouts\Updates;
4
5 use Drupal\bootstrap_layouts\BootstrapLayout;
6 use Drupal\bootstrap_layouts\Plugin\BootstrapLayouts\BootstrapLayoutsUpdateBase;
7
8 /**
9  * Bootstrap Layouts Update 8402
10  *
11  * Fix "1 Column (stacked)" regions.
12  *
13  * @BootstrapLayoutsUpdate(
14  *   id = "bootstrap_layouts_update_8402",
15  *   schema = 8402
16  * )
17  */
18 class BootstrapLayoutsUpdate8402 extends BootstrapLayoutsUpdateBase {
19
20   /**
21    * {@inheritdoc}
22    */
23   public function processExistingLayout(BootstrapLayout $layout, array $data = [], $display_messages = TRUE) {
24     if ($layout->getId() !== 'bs_1col_stacked') {
25       return;
26     }
27
28     $regions = [
29       'header' => 'top',
30       'footer' => 'bottom',
31     ];
32     foreach ($regions as $old_region => $new_region) {
33       if ($region = $layout->getRegion($old_region)) {
34         $layout->setRegion($new_region, $region);
35         $layout->unsetRegion($old_region);
36       }
37     }
38   }
39
40 }