Yii2 Extension to handle multi-form wizards.
This is the Yii2 version of my popular Wizard Behavior extension for Yii1
Source is on GitHub at beastbytes/yii2-wizard
The preferred way to install this extension is through composer.
php composer.phar require --prefer-dist beastbytes/yii2-wizard
to the require section of your composer.json.
Below is a very short overview of how to use the extension; the examples folder shows how to implement PBN, looping, forward only navigation, and step timeout in examples of a quiz, survey, and registration.
Attach WizardBehavior to a controller.
The controller contains the event handlers; the two most important events are WizardBehavior::EVENT_WIZARD_STEP and WizardBehavior::EVENT_AFTER_WIZARD, these are responsible for handling the steps of the wizard and processing the data at the end of the wizard respectively.
The controller action is very simple:
public function actionWizard($step = null)
This event's handler is responsible for validating submitted data and deciding in what direction the Wizard should proceed; this and the data to be stored is placed into the event. When the event is marked as handled by handler the wizard will take the appropriate action.
The handler for this event is responsible for taking the required action once the Wizard has completed; this could be rendering a page based on the user input and/or saving the data to persistant storage.