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

View File

@ -412,12 +412,13 @@ abstract class MultiForm extends Form
// If there is a previous step defined, add the back button
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 ($step->getNextStep()) {
$actions->insertBefore($prev = FormAction::create('prev', $step->getPrevText()), 'action_next');
// Assume that this is the last step, insert the action before the finish action
$actions->insertBefore('action_next', $prev);
} else {
$actions->insertBefore($prev = FormAction::create('prev', $step->getPrevText()), 'action_finish');
$actions->insertBefore('action_finish', $prev);
}
//remove browser validation from prev action
$prev->setAttribute("formnovalidate", "formnovalidate");