mirror of
https://github.com/silverstripe/silverstripe-multiform
synced 2024-10-22 11:05:49 +02:00
ENHANCEMENT MultiFormStep->form can now be accessed to return the form that the step was created on
This commit is contained in:
parent
fe8b3f57ef
commit
35f2de5de3
@ -93,6 +93,9 @@ abstract class MultiForm extends Form {
|
||||
// Set the step returned above as the current step
|
||||
$this->setCurrentStep($currentStep);
|
||||
|
||||
// Set the form of the step to this form instance
|
||||
$currentStep->form = $this;
|
||||
|
||||
// Set up the fields for the current step
|
||||
$this->setFields($currentStep->getFields());
|
||||
|
||||
@ -158,6 +161,7 @@ abstract class MultiForm extends Form {
|
||||
|
||||
/**
|
||||
* Set the step passed in as the current step.
|
||||
*
|
||||
* @param MultiFormStep $step A subclass of MultiFormStep
|
||||
*/
|
||||
protected function setCurrentStep($step) {
|
||||
@ -167,6 +171,7 @@ abstract class MultiForm extends Form {
|
||||
|
||||
/**
|
||||
* Accessor method to $this->session.
|
||||
*
|
||||
* @return MultiFormSession
|
||||
*/
|
||||
function getSession() {
|
||||
|
@ -65,6 +65,13 @@ class MultiFormStep extends DataObject {
|
||||
*/
|
||||
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 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 ####################
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user