Version 1
[yaffs-website] / web / modules / contrib / bootstrap_layouts / src / Plugin / BootstrapLayouts / Updates / BootstrapLayoutsUpdate8402.php
diff --git a/web/modules/contrib/bootstrap_layouts/src/Plugin/BootstrapLayouts/Updates/BootstrapLayoutsUpdate8402.php b/web/modules/contrib/bootstrap_layouts/src/Plugin/BootstrapLayouts/Updates/BootstrapLayoutsUpdate8402.php
new file mode 100644 (file)
index 0000000..9d7f0b2
--- /dev/null
@@ -0,0 +1,40 @@
+<?php
+
+namespace Drupal\bootstrap_layouts\Plugin\BootstrapLayouts\Updates;
+
+use Drupal\bootstrap_layouts\BootstrapLayout;
+use Drupal\bootstrap_layouts\Plugin\BootstrapLayouts\BootstrapLayoutsUpdateBase;
+
+/**
+ * Bootstrap Layouts Update 8402
+ *
+ * Fix "1 Column (stacked)" regions.
+ *
+ * @BootstrapLayoutsUpdate(
+ *   id = "bootstrap_layouts_update_8402",
+ *   schema = 8402
+ * )
+ */
+class BootstrapLayoutsUpdate8402 extends BootstrapLayoutsUpdateBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function processExistingLayout(BootstrapLayout $layout, array $data = [], $display_messages = TRUE) {
+    if ($layout->getId() !== 'bs_1col_stacked') {
+      return;
+    }
+
+    $regions = [
+      'header' => 'top',
+      'footer' => 'bottom',
+    ];
+    foreach ($regions as $old_region => $new_region) {
+      if ($region = $layout->getRegion($old_region)) {
+        $layout->setRegion($new_region, $region);
+        $layout->unsetRegion($old_region);
+      }
+    }
+  }
+
+}