From 5516d0943f831d62445bc4d2816ef8784f0c5f82 Mon Sep 17 00:00:00 2001
From: Lily Yan <lily.yan@uwaterloo.ca>
Date: Tue, 24 Nov 2020 10:32:50 -0500
Subject: [PATCH] ISTWCMS-4209 Make sure the preview option is disabled when
 creating new content types

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

diff --git a/uw_cfg_common.module b/uw_cfg_common.module
index 10a21fb1..45770f0d 100644
--- a/uw_cfg_common.module
+++ b/uw_cfg_common.module
@@ -211,3 +211,13 @@ function uw_cfg_common_preprocess_node(&$variables) {
     $variables['uw_content_moderation_form'] = $render;
   }
 }
+
+/**
+ * Implements hook_form_FORM_ID_alter().
+ *
+ * Set the default of preview mode disabled.
+ */
+function uw_cfg_common_form_node_type_add_form_alter(&$form, FormStateInterface $form_state, $form_id) {
+  $form['submission']['preview_mode']['#default_value'] = 0;
+
+}
-- 
GitLab