From 6ddcea3c71d89cc514b4bf9404316c84837aedd2 Mon Sep 17 00:00:00 2001
From: Jacob Rockowitz <21160-jrockowitz@users.noreply.drupalcode.org>
Date: Tue, 5 Nov 2024 23:37:30 +0000
Subject: [PATCH] Issue #3468130 by jrockowitz, sethhill: Allow query string
 parameters to be passed from the add node form to mercury editor

---
 src/Controller/MercuryEditorHtmlEntityFormController.php | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/Controller/MercuryEditorHtmlEntityFormController.php b/src/Controller/MercuryEditorHtmlEntityFormController.php
index 05c66dda..67b4fe86 100644
--- a/src/Controller/MercuryEditorHtmlEntityFormController.php
+++ b/src/Controller/MercuryEditorHtmlEntityFormController.php
@@ -78,14 +78,15 @@ class MercuryEditorHtmlEntityFormController extends FormController {
         // If entity type / bundle is ME enabled:
         if (isset($bundles[$entity_type_id][$bundle_id])) {
           $this->tempstore->set($entity);
-          $request->query->remove('destination');
           $params = [
             'mercury_editor_entity' => $entity->uuid(),
           ];
+          $query = $request->query->all();
+          // Remove the destination parameter from the query to prevent
+          // the destination redirect from being triggered.
+          $request->query->remove('destination');
           $options = [
-            'query' => [
-              'destination' => $request->get('destination'),
-            ],
+            'query' => $query,
           ];
           return new RedirectResponse(Url::fromRoute('mercury_editor.editor', $params, $options)->toString());
         }
-- 
GitLab