From 77a27dd883dc61349a01f77cf8d4da1171bec5ef Mon Sep 17 00:00:00 2001
From: ebremner <ebremner@uwaterloo.ca>
Date: Mon, 9 Nov 2020 16:05:48 -0500
Subject: [PATCH] ISTWECMS-4166: cleaning up submit function for content
 moderation

---
 src/Form/UwContentModerationForm.php | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/Form/UwContentModerationForm.php b/src/Form/UwContentModerationForm.php
index 380c2c04..d7923dfc 100644
--- a/src/Form/UwContentModerationForm.php
+++ b/src/Form/UwContentModerationForm.php
@@ -80,8 +80,17 @@ class UwContentModerationForm extends ConfirmFormBase {
    */
   public function submitForm(array &$form, FormStateInterface $form_state) {
 
+    // Set the options for the URL.
+    $options = ['absolute' => TRUE];
+
+    // Return the URL back to the node.
+    $url =  Url::fromRoute('entity.node.canonical', ['node' => $this->nid], $options);
+
+    // Adding the redirect back to the node
+    $form_state->setRedirectUrl($url);
+
     // Set the message that the permissions have been saved.
-    $this->messenger()->addStatus($this->t('The changes have been saved.'));
+    $this->messenger()->addStatus($this->t('There is still work to be done to unpublish, but we made it here.'));
   }
 
   /**
-- 
GitLab