fix: correct argument order for insertBefore

This commit is contained in:
Will Rossiter 2023-09-06 22:21:35 +12:00
parent 0d7eb7b83f
commit 7bf4d10478
No known key found for this signature in database
GPG Key ID: 7FD2A809B22259EF
1 changed files with 5 additions and 4 deletions

View File

@ -412,12 +412,13 @@ abstract class MultiForm extends Form
// If there is a previous step defined, add the back button // If there is a previous step defined, add the back button
if ($step->getPreviousStep() && $step->canGoBack()) { if ($step->getPreviousStep() && $step->canGoBack()) {
$prev = FormAction::create('prev', $step->getPrevText());
// If there is a next step, insert the action before the next action // If there is a next step, insert the action before the next action
if ($step->getNextStep()) { if ($step->getNextStep()) {
$actions->insertBefore($prev = FormAction::create('prev', $step->getPrevText()), 'action_next'); $actions->insertBefore('action_next', $prev);
// Assume that this is the last step, insert the action before the finish action
} else { } else {
$actions->insertBefore($prev = FormAction::create('prev', $step->getPrevText()), 'action_finish'); $actions->insertBefore('action_finish', $prev);
} }
//remove browser validation from prev action //remove browser validation from prev action
$prev->setAttribute("formnovalidate", "formnovalidate"); $prev->setAttribute("formnovalidate", "formnovalidate");
@ -678,7 +679,7 @@ abstract class MultiForm extends Form
$stepsFound->push($nextStep); $stepsFound->push($nextStep);
$this->getAllStepsRecursive($nextStep, $stepsFound); $this->getAllStepsRecursive($nextStep, $stepsFound);
} }
// Once we've reached the final step, we just return what we've collected // Once we've reached the final step, we just return what we've collected
} else { } else {
return $stepsFound; return $stepsFound;
} }