SproutCMS

This is the code documentation for the SproutCMS project

class MultiStepFormController

Supports multistep forms

Extending this class

<?php
/**
* New class description goes here
* 
* @author Your Name, 2026-09-15
**/
class NewClassName extends MultiStepFormController {
    
    /**
    * Check the user has access to a step
    **/
    protected function checkStep ($session, $step) {
        // Method code goes here
    }
    
    /**
    * Instantiate the session and make sure the session key is useable
    **/
    protected function getSession () {
        // Method code goes here
    }
    
    protected function validate (int $step, array $reqd, array $rules, Validator $valid) {
        // Method code goes here
    }
    
    /**
    * Builds a URL to the form at a particular step
    **/
    protected function buildUrl (int $step, bool $include_first) {
        // Method code goes here
    }
    
    /**
    * Do any final preparation / data massaging; then call saveData and finally redirect.
    * This should generally be overridden.
    **/
    protected function save () {
        // Method code goes here
    }
    
    /**
    * Save the data, e.g. into a database, after successful validation at the
    * final step
    **/
    protected function saveData (string $table, array $sub_tables, array $extra_fields) {
        // Method code goes here
    }
    
    /**
    * Gets the number (should be 0 or 1) of first step of the process
    **/
    protected function firstStep () {
        // Method code goes here
    }
    
    /**
    * The method used to drive the form submissions at each step
    * This should be called by the submit function of the subclass controller
    **/
    protected function submit (int $step) {
        // Method code goes here
    }
    
    /**
    * Display the thanks message after the process has been completed
    **/
    public function complete () {
        // Method code goes here
    }
    
    /**
    * The method used to drive the forms at each step
    * This should be called by the entry function of the subclass controller
    **/
    protected function form (int $step) {
        // Method code goes here
    }
    
}
?>