Skip to content

Commit

Permalink
IBX-7957: Suppressed validation on Save and Close (#65)
Browse files Browse the repository at this point in the history
* IBX-7957: Suppressed validation on `Save and Close`

* IBX-7957: Refactored code

---------

Co-authored-by: Bartek Wajda <[email protected]>
  • Loading branch information
barw4 and bwajda authored Mar 27, 2024
1 parent 519420a commit 93b7a7c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/lib/Form/EventSubscriber/SuppressValidationSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

Expand Down

0 comments on commit 93b7a7c

Please sign in to comment.