mirror of
https://github.com/silverstripe/silverstripe-multiform
synced 2024-10-22 11:05:49 +02:00
fix: correct argument order for insertBefore
This commit is contained in:
parent
0d7eb7b83f
commit
7bf4d10478
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user