From b021bc197dcfcbd04e9d981a973574ea5ca5f235 Mon Sep 17 00:00:00 2001
From: Eric Bremner <ebremner@uwaterloo.ca>
Date: Mon, 16 Aug 2021 18:03:44 +0000
Subject: [PATCH] ISTWCMS-4866: adding logic for layout and non-layout pages to
 preprocess html

---
 uw_fdsu_theme_resp.theme | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/uw_fdsu_theme_resp.theme b/uw_fdsu_theme_resp.theme
index 897088ed..df377970 100644
--- a/uw_fdsu_theme_resp.theme
+++ b/uw_fdsu_theme_resp.theme
@@ -57,6 +57,19 @@ function uw_fdsu_theme_resp_preprocess_html(&$variables) {
       break;
 
   }
+
+  // Get the current path.
+  $parts = explode('/', \Drupal::service('path.current')->getPath());
+
+  // If the last in the array parts is not layout,
+  // add a class so that we traget anything but
+  // the layout pages.
+  if (end($parts) !== 'layout') {
+    $variables['attributes']['class'][] = 'not-layout-page';
+  }
+  else {
+    $variables['attributes']['class'][] = 'layout-page';
+  }
 }
 
 /**
@@ -145,19 +158,6 @@ function uw_fdsu_theme_resp_preprocess_region(&$variables) {
       $variables['classes'][] = 'layout';
       $variables['classes'][] = 'uw-contained-width';
     }
-
-    if ($route_name == 'entity.node.canonical') {
-
-      // Get the current path.
-      $parts = explode('/', \Drupal::service('path.current')->getPath());
-
-      // If the last in the array parts is not layout,
-      // add a class so that we traget anything but
-      // the layout pages.
-      if (end($parts) !== 'layout') {
-        $variables['classes'][] = 'not-layout-page';
-      }
-    }
   }
 }
 
-- 
GitLab