From df8a541a33ba811bf9d0106f7b7ff7d734e75a0a Mon Sep 17 00:00:00 2001
From: Lily Yan <l26yan@uwaterloo.ca>
Date: Tue, 20 Dec 2022 11:23:48 -0500
Subject: [PATCH] ISTWCMS-5985 Remove all remaining ability to set CSS classes,
 CSS styles and custom attributes (YAML) for webform elements

---
 uw_cfg_common.module | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/uw_cfg_common.module b/uw_cfg_common.module
index 9b3c85d1..240c7251 100644
--- a/uw_cfg_common.module
+++ b/uw_cfg_common.module
@@ -259,10 +259,22 @@ function uw_cfg_common_form_webform_admin_config_submissions_form_alter(array &$
 /**
  * Implements hook_form_FORM_ID_alter().
  *
- * Remove wrapper attributes in admin/structure/webform/manage/{webform_id}.
+ * Remove all ability to set CSS classes, CSS styles and custom attributes
+ * in admin/structure/webform/manage/{webform_id}.
  */
 function uw_cfg_common_form_webform_ui_element_form_alter(array &$form, FormStateInterface $form_state, string $form_id): void {
+  // Advanced -> Wrapper Attributes.
   $form['properties']['wrapper_attributes']['#access'] = FALSE;
+  // Advanced -> Element Attributes.
+  $form['properties']['element_attributes']['#access'] = FALSE;
+  // Advanced -> Label Attributes.
+  $form['properties']['label_attributes']['#access'] = FALSE;
+  // Advanced -> Submission Display -> Display Wrapper Attributes.
+  $form['properties']['display']['format_attributes']['#access'] = FALSE;
+  // Advanced -> Summary Attributes.
+  $form['properties']['summary_attributes']['#access'] = FALSE;
+  // Advanced -> Title Attributes.
+  $form['properties']['title_attributes']['#access'] = FALSE;
 }
 
 /**
-- 
GitLab