Merged revisions 49386 via svnmerge from

svn://svn.silverstripe.com/silverstripe/modules/sapphire/branches/2.2.0-mesq

........
  r49386 | ischommer | 2008-02-12 09:24:29 +1300 (Tue, 12 Feb 2008) | 2 lines
  
  added setFields()/setActions()
  formatting
........


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@49380 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2008-02-11 20:25:22 +00:00
parent 603f1e6996
commit 0121fb8fe2

View File

@ -22,7 +22,17 @@
* @subpackage core * @subpackage core
*/ */
class Form extends ViewableData { class Form extends ViewableData {
protected $fields, $actions, $controller, $name, $validator;
protected $fields;
protected $actions;
protected $controller;
protected $name;
protected $validator;
protected $formMethod = "post"; protected $formMethod = "post";
public static $backup_post_data = false; public static $backup_post_data = false;
@ -56,9 +66,7 @@ class Form extends ViewableData {
function __construct($controller, $name, FieldSet $fields, FieldSet $actions, $validator = null) { function __construct($controller, $name, FieldSet $fields, FieldSet $actions, $validator = null) {
parent::__construct(); parent::__construct();
foreach($fields as $field) { foreach($fields as $field) $field->setForm($this);
$field->setForm($this);
}
foreach($actions as $action) $actions->setForm($this); foreach($actions as $action) $actions->setForm($this);
$this->fields = $fields; $this->fields = $fields;
@ -196,6 +204,15 @@ class Form extends ViewableData {
return $this->fields; return $this->fields;
} }
/**
* Setter for the form fields.
*
* @param FieldSet $fields
*/
function setFields($fields) {
$this->fields = $fields;
}
/** /**
* Get a named field from this form's fields. * Get a named field from this form's fields.
* It will traverse into composite fields for you, to find the field you want. * It will traverse into composite fields for you, to find the field you want.
@ -215,6 +232,15 @@ class Form extends ViewableData {
return $this->actions; return $this->actions;
} }
/**
* Setter for the form actions.
*
* @param FieldSet $actions
*/
function setActions($actions) {
$this->actions = $actions;
}
/** /**
* Unset all form actions * Unset all form actions
*/ */