From 2f1ee2e9ddcff05a6f1ef64b56a02713cca9fd95 Mon Sep 17 00:00:00 2001
From: hkirsman <hkirsman@1860980.no-reply.drupal.org>
Date: Thu, 14 Apr 2022 20:54:42 +0300
Subject: [PATCH] Issue #3274569 by hkirsman: Disable in admin

---
 stacktable.module | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/stacktable.module b/stacktable.module
index 7eee85c..eae3e95 100644
--- a/stacktable.module
+++ b/stacktable.module
@@ -11,6 +11,11 @@ use Drupal\Core\Render\Markup;
  * Implements hook_page_attachments().
  */
 function stacktable_page_attachments(array &$page) {
+  // Don't enable in admin.
+  if (\Drupal::service('router.admin_context')->isAdminRoute()) {
+    return;
+  }
+
   $config = \Drupal::config('stacktable.settings');
   $page['#attached']['library'][] = 'stacktable/stacktablejs_init';
 
@@ -38,6 +43,11 @@ function stacktable_page_attachments(array &$page) {
  * Adds label for the placeholder for tables that are opened in modal.
  */
 function stacktable_preprocess_html(&$variables) {
+  // Don't enable in admin.
+  if (\Drupal::service('router.admin_context')->isAdminRoute()) {
+    return;
+  }
+
   $config = \Drupal::config('stacktable.settings');
 
   // Sub-feature of "On demand" method is opening the table in modal - add
-- 
GitLab