-
Notifications
You must be signed in to change notification settings - Fork 0
Next Step
By default, Wizard will process steps in the order defined. However, if Wizard::forwardOnly === false (default), Wizard can return to earlier steps; it can not jump ahead (but see Plot Branching Navigation).
To instruct Wizard to go to an earlier step, the event hander calls Step::goto($goto). $goto is either:
- the name of an earlier step
- Wizard::DIRECTION_BACKWARD - returns to the previous step
- Wizard::DIRECTION_FORWARD - goes to the next step (default behaviour if the event handler does not call Step::goto())
If Wizard is returned to an earlier step, Wizard::autoAdvance determines the next step once the returned to step has been processed.
- Wizard::autoAdvance === Wizard::AUTO_ADVANCE (true) - Wizard goes to the first unprocessed step (default)
- Wizard::autoAdvance === !Wizard::AUTO_ADVANCE (false) - Wizard goes to the next step
In this example, when Wizard returns to and processes step_2, Wizard will go to step_6.
$this
->wizard
->withAutoAdvance(Wizard::AUTO_ADVANCE)
->steps(['step_1', 'step_2', 'step_3', 'step_4', 'go_to_step_2', 'step_6', 'step_7']);In this example, when Wizard returns to and processes step_2, Wizard will go to step_3.
$this
->wizard
->withAutoAdvance(!Wizard::AUTO_ADVANCE)
->steps(['step_1', 'step_2', 'step_3', 'step_4', 'go_to_step_2', 'step_6', 'step_7']);Wizard can repeat a step to collect multiple sets of the same data. To repeat a step, the event hander calls Step::goto($goto), where $goto === Wizard::DIRECTION_REPEAT.
It is the event handler's responsibility to determine how many times the step is repeated.
Data for a repeated step is saved in the normal way, i.e. $event->setData($form). Wizard takes care of saving multiple sets of repeated data.