public function prev($data, $form)
    {
        // Save the form data for the current step
        $this->save($form->getData());

        // Get the previous step class
        $prevStepClass = $this->getCurrentStep()->getPreviousStep();

        if (!$prevStepClass && !$this->getCurrentStep()->canGoBack()) {
            $this->controller->redirectBack();
            return false;
        }

        // Get the previous step of the class instance returned from $currentStep->getPreviousStep()
        $prevStep = DataObject::get_one($prevStepClass, "\"SessionID\" = {$this->session->ID}");

        // Set the current step as the previous step
        $this->setCurrentStep($prevStep);

        // Redirect to the previous step
        return $this->controller->redirect($prevStep->Link());
    }
public function prev($data, $form)
    {
        // Save the form data for the current step
        $this->save($form->getData());

        // Get the previous step class
        $prevStepClass = $this->getCurrentStep()->getPreviousStep();

        if (!$prevStepClass && !$this->getCurrentStep()->canGoBack()) {
            $this->controller->redirectBack();
            return false;
        }

        // Get the previous step of the class instance returned from $currentStep->getPreviousStep()
        $prevStep = DataObject::get_one($prevStepClass, "\"SessionID\" = {$this->session->ID}");

        // Set the current step as the previous step
        $this->setCurrentStep($prevStep);

        // Redirect to the previous step
        return $this->controller->redirect($prevStep->Link());
    }
public function prev ( $ data , $ form ) { // Save the form data for the current step $ this -> save ( $ form -> getData ( ) ) ; // Get the previous step class $ prevStepClass = $ this -> getCurrentStep ( ) -> getPreviousStep ( ) ; if ( ! $ prevStepClass && ! $ this -> getCurrentStep ( ) -> canGoBack ( ) ) { $ this -> controller -> redirectBack ( ) ; return false ; } // Get the previous step of the class instance returned from $currentStep->getPreviousStep() $ prevStep = DataObject :: get_one ( $ prevStepClass , "\"SessionID\" = {$this->session->ID}" ) ; // Set the current step as the previous step $ this -> setCurrentStep ( $ prevStep ) ; // Redirect to the previous step return $ this -> controller -> redirect ( $ prevStep -> Link ( ) ) ; }
Determine what to do when the previous action is called.

Retrieves the previous step class, finds the record for that
class in the DB, and sets the current step to that step found.
Finally, it redirects to that step.

@param array $data The request data returned from the form
@param Form $form The form that the action was called on
@return bool|HTTPResponse
Determine what to do when the previous action is called .