From 93b7a7c5e46560704a95fd834abae55775325478 Mon Sep 17 00:00:00 2001 From: Bartek Wajda Date: Wed, 27 Mar 2024 12:23:50 +0100 Subject: [PATCH] IBX-7957: Suppressed validation on `Save and Close` (#65) * IBX-7957: Suppressed validation on `Save and Close` * IBX-7957: Refactored code --------- Co-authored-by: Bartek Wajda --- .../EventSubscriber/SuppressValidationSubscriber.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lib/Form/EventSubscriber/SuppressValidationSubscriber.php b/src/lib/Form/EventSubscriber/SuppressValidationSubscriber.php index 4d4d0ba5..978dbf41 100644 --- a/src/lib/Form/EventSubscriber/SuppressValidationSubscriber.php +++ b/src/lib/Form/EventSubscriber/SuppressValidationSubscriber.php @@ -42,10 +42,11 @@ public function suppressValidationOnSaveDraft(PostSubmitEvent $event) { $form = $event->getForm(); - if ($form->has('saveDraft')) { - if ($form->get('saveDraft')->isClicked()) { - $event->stopPropagation(); - } + if ( + ($form->has('saveDraft') && $form->get('saveDraft')->isClicked()) + || ($form->has('saveDraftAndClose') && $form->get('saveDraftAndClose')->isClicked()) + ) { + $event->stopPropagation(); } }