From 4a89f91609049c7830ef623de45708fc73a03e90 Mon Sep 17 00:00:00 2001
From: Eric Bremner <ebremner@uwaterloo.ca>
Date: Wed, 20 Apr 2022 11:04:06 -0400
Subject: [PATCH] ISTWCMS-4729: cleaning up site search form to have no parent
 form item divs

---
 src/Form/UwSearchForm.php | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/src/Form/UwSearchForm.php b/src/Form/UwSearchForm.php
index c22d6aa7..007828fd 100644
--- a/src/Form/UwSearchForm.php
+++ b/src/Form/UwSearchForm.php
@@ -43,6 +43,23 @@ class UwSearchForm extends FormBase {
           'uw-input--checkboxform',
         ],
       ],
+      '#theme_wrappers' => [],
+    ];
+
+    // This is the label that is used for the "phone" view on
+    // the site search.  We need to use form element label here
+    // by itself, since we use theme_wrappers as an empty array
+    // above in the input, which would normally give us the form
+    // label.
+    $form['label'] = [
+      '#theme' => 'form_element_label',
+      '#title' => $this->t('<span class="uw-search--checkboxlabel--labeltext"></span>'),
+      '#title_display' => 'after',
+      '#required' => FALSE,
+      '#id' => 'edit-opentray',
+      '#attributes' => [
+        'class' => ['uw-search--checkboxlabel'],
+      ],
     ];
 
     // The search text.
-- 
GitLab