mirror of
https://github.com/silverstripe/silverstripe-multiform
synced 2024-10-22 11:05:49 +02:00
Docs, bug fixes in code
This commit is contained in:
parent
eb5b57f418
commit
facf2e3833
@ -32,8 +32,8 @@ class MultiFormStep extends DataObject {
|
|||||||
protected static $next_steps;
|
protected static $next_steps;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Each {@link MultiForm} subclass
|
* Each {@link MultiForm} subclass needs at least
|
||||||
* needs at least one step which is marked as the "final" one
|
* one step which is marked as the "final" one
|
||||||
* and triggers the {@link MultiForm->finish()}
|
* and triggers the {@link MultiForm->finish()}
|
||||||
* method that wraps up the whole submission.
|
* method that wraps up the whole submission.
|
||||||
*
|
*
|
||||||
@ -50,9 +50,11 @@ class MultiFormStep extends DataObject {
|
|||||||
protected $title;
|
protected $title;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Formfields 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}.
|
||||||
* This function needs to be implemented
|
*
|
||||||
|
* This function needs to be implemented on your
|
||||||
|
* subclasses of MultiFormStep
|
||||||
*
|
*
|
||||||
* @return FieldSet
|
* @return FieldSet
|
||||||
*/
|
*/
|
||||||
@ -61,6 +63,11 @@ class MultiFormStep extends DataObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Additional form actions to be rendered with this step.
|
||||||
|
* (Form object is created in {@link MultiForm}.
|
||||||
|
*
|
||||||
|
* Note: This is optional, and is to be implemented
|
||||||
|
* on your subclasses of MultiFormStep
|
||||||
*
|
*
|
||||||
* @return FieldSet
|
* @return FieldSet
|
||||||
*/
|
*/
|
||||||
@ -70,15 +77,17 @@ class MultiFormStep extends DataObject {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a validator specific to this form.
|
* Get a validator specific to this form.
|
||||||
*
|
*
|
||||||
* @return Validator
|
* @return Validator
|
||||||
*/
|
*/
|
||||||
public function getValidator() {
|
public function getValidator() {
|
||||||
return null;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Accessor method for $this->title
|
* Accessor method for $this->title
|
||||||
|
*
|
||||||
|
* @return string Title of this step
|
||||||
*/
|
*/
|
||||||
public function getTitle() {
|
public function getTitle() {
|
||||||
return $this->title;
|
return $this->title;
|
||||||
@ -108,8 +117,6 @@ class MultiFormStep extends DataObject {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Save the data for this step into session, serializing it first.
|
* Save the data for this step into session, serializing it first.
|
||||||
*
|
|
||||||
* @TODO write a code snippet on how to overload this method!
|
|
||||||
*
|
*
|
||||||
* @param array $data The processed data from save() on MultiForm
|
* @param array $data The processed data from save() on MultiForm
|
||||||
*/
|
*/
|
||||||
@ -153,11 +160,11 @@ class MultiFormStep extends DataObject {
|
|||||||
public function getNextStepFromDatabase() {
|
public function getNextStepFromDatabase() {
|
||||||
$nextSteps = $this->stat('next_steps');
|
$nextSteps = $this->stat('next_steps');
|
||||||
if(is_string($nextSteps)) {
|
if(is_string($nextSteps)) {
|
||||||
$step = DataObject::get($nextSteps, "SessionID = {$this->SessionID}", 'LastEdited DESC');
|
$step = DataObject::get_one($nextSteps, "SessionID = {$this->SessionID}");
|
||||||
if($step) return $step->First();
|
if($step) return $step;
|
||||||
} elseif(is_array($nextSteps)) {
|
} elseif(is_array($nextSteps)) {
|
||||||
$step = DataObject::get($nextSteps[0], "SessionID = {$this->SessionID}", 'LastEdited DESC');
|
$step = DataObject::get_one($nextSteps[0], "SessionID = {$this->SessionID}");
|
||||||
if($step) return $step->First();
|
if($step) return $step;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user