ENHANCEMENT MultiFormStep->form can now be accessed to return the form that the step was created on

This commit is contained in:
Sean Harvey 2008-06-18 08:07:11 +00:00
parent fe8b3f57ef
commit 35f2de5de3
2 changed files with 21 additions and 0 deletions

View File

@ -93,6 +93,9 @@ abstract class MultiForm extends Form {
// Set the step returned above as the current step // Set the step returned above as the current step
$this->setCurrentStep($currentStep); $this->setCurrentStep($currentStep);
// Set the form of the step to this form instance
$currentStep->form = $this;
// Set up the fields for the current step // Set up the fields for the current step
$this->setFields($currentStep->getFields()); $this->setFields($currentStep->getFields());
@ -158,6 +161,7 @@ abstract class MultiForm extends Form {
/** /**
* Set the step passed in as the current step. * Set the step passed in as the current step.
*
* @param MultiFormStep $step A subclass of MultiFormStep * @param MultiFormStep $step A subclass of MultiFormStep
*/ */
protected function setCurrentStep($step) { protected function setCurrentStep($step) {
@ -167,6 +171,7 @@ abstract class MultiForm extends Form {
/** /**
* Accessor method to $this->session. * Accessor method to $this->session.
*
* @return MultiFormSession * @return MultiFormSession
*/ */
function getSession() { function getSession() {

View File

@ -65,6 +65,13 @@ class MultiFormStep extends DataObject {
*/ */
protected $title; protected $title;
/**
* Form class that this step is directly related to.
*
* @var MultiForm subclass
*/
protected $form;
/** /**
* Form fields to be rendered with this step. * Form fields to be rendered with this step.
* (Form object is created in {@link MultiForm}. * (Form object is created in {@link MultiForm}.
@ -244,6 +251,15 @@ class MultiFormStep extends DataObject {
} }
} }
/**
* Sets the form that this step is directly related to.
*
* @param MultiForm subclass $form
*/
public function setForm($form) {
$this->form = $form;
}
// ##################### Utility #################### // ##################### Utility ####################
/** /**