Skip to content

Commit

Permalink
Allow to continue on empty steps
Browse files Browse the repository at this point in the history
  • Loading branch information
Toflar committed Dec 6, 2023
1 parent a045219 commit bbff435
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/EventListener/PrepareFomDataListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,14 @@ public function __invoke(array &$submitted, array &$labels, array $fields, Form
$labelsBag = new ParameterBag($labels);

$pageSwitchValue = $submittedBag->get('mp_form_pageswitch', '');
$submittedBag->remove('mp_form_pageswitch');

// Remove the page switch value field from the submitted data if that's the last step, so it's not passed on
// in e-mail notifications and the like. However, in intermediate steps we need it because otherwise it's not
// possible to have an empty step (e.g. only explanation fields) as the step data would be empty and
// getFirstInvalidStep() would return the one before the empty step.
if ($manager->isLastStep()) {
$submittedBag->remove('mp_form_pageswitch');
}

// Store data in session
$stepData = $manager->getDataOfCurrentStep();
Expand Down

0 comments on commit bbff435

Please sign in to comment.