From c3d9092b5f2ce12148b3bbd561e81fdf4046f6cd Mon Sep 17 00:00:00 2001
From: ebremner <ebremner@uwaterloo.ca>
Date: Fri, 28 Aug 2020 11:33:11 -0400
Subject: [PATCH] ISTWCMS-4053: adding one column layout

---
 src/Plugin/Layout/UwOneColumnLayout.php | 37 +++++++++++++++++++++++++
 uw_cfg_common.layouts.yml               | 11 ++++++++
 2 files changed, 48 insertions(+)
 create mode 100644 src/Plugin/Layout/UwOneColumnLayout.php

diff --git a/src/Plugin/Layout/UwOneColumnLayout.php b/src/Plugin/Layout/UwOneColumnLayout.php
new file mode 100644
index 00000000..a78b1f7c
--- /dev/null
+++ b/src/Plugin/Layout/UwOneColumnLayout.php
@@ -0,0 +1,37 @@
+<?php
+
+namespace Drupal\uw_cfg_common\Plugin\Layout;
+
+use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Layout\LayoutDefault;
+use Drupal\Core\Plugin\PluginFormInterface;
+
+/**
+ * A UW one column layout.
+ *
+ * @Layout(
+ *   id = "uw_one_column",
+ *   label = @Translation("One column"),
+ *   category = @Translation("UW layouts"),
+ *   template = "templates/layout/layout--uwonecol",
+ *   regions = {
+ *     "first" = {
+ *       "label" = @Translation("Column 1"),
+ *     },
+ *   }
+ * )
+ */
+class UwOneColumnLayout extends LayoutDefault implements PluginFormInterface {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function build(array $regions) {
+
+    // Build the render array as usual.
+    $build = parent::build($regions);
+
+    return $build;
+  }
+
+}
diff --git a/uw_cfg_common.layouts.yml b/uw_cfg_common.layouts.yml
index cf54fc4f..6c12d9ff 100644
--- a/uw_cfg_common.layouts.yml
+++ b/uw_cfg_common.layouts.yml
@@ -1,3 +1,14 @@
+uw_one_column:
+  label: 'UW One column'
+  category: 'UW layouts'
+  class: '\Drupal\uw_cfg_common\Plugin\Layout\UwOneColumnLayout'
+  template: uw_fdsu_theme_resp/templates/layout/layout--uwonecol
+  default_region: first
+  regions:
+    first:
+      label: One
+  icon_map:
+    - [first]
 uw_two_column:
   label: 'UW Two columns'
   category: 'UW layouts'
-- 
GitLab