From af6dbb7ae0f26c80243ec92d1435b61860c6e380 Mon Sep 17 00:00:00 2001
From: Eric Bremner <ebremner@uwaterloo.ca>
Date: Mon, 16 Sep 2024 15:23:47 -0400
Subject: [PATCH] ISTWCMS-6978: update code that sets paginator id to use
 straight variable instead of array

---
 uw_dashboard.module | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/uw_dashboard.module b/uw_dashboard.module
index 95d44ef..7d7b62e 100644
--- a/uw_dashboard.module
+++ b/uw_dashboard.module
@@ -129,11 +129,11 @@ function uw_dashboard_entity_type_alter(array &$entity_types) {
 function uw_dashboard_views_pre_execute(ViewExecutable $view) {
 
   // Have a variable that can be used "globally".
-  static $view_instances = [];
+  static $view_instances_count;
 
   // If there is no count yet, set it to 0.
-  if (!isset($view_instances['count'])) {
-    $view_instances['count'] = 0;
+  if (!isset($view_instances_count)) {
+    $view_instances_count = 0;
   }
 
   // The views that need the pager id adjusted.
@@ -148,9 +148,9 @@ function uw_dashboard_views_pre_execute(ViewExecutable $view) {
   if (in_array($view->id(), $view_ids)) {
 
     // Increment the counter, so we get the correct pager id.
-    $view_instances['count']++;
+    $view_instances_count++;
 
     // Set the pager id in the view.
-    $view->pager->options['id'] = $view_instances['count'];
+    $view->pager->options['id'] = $view_instances_count;
   }
 }
-- 
GitLab