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
*/
class Form extends ViewableData {
protected $fields, $actions, $controller, $name, $validator;
protected $fields;
protected $actions;
protected $controller;
protected $name;
protected $validator;
protected $formMethod = "post";
public static $backup_post_data = false;
@ -56,9 +66,7 @@ class Form extends ViewableData {
function __construct($controller, $name, FieldSet $fields, FieldSet $actions, $validator = null) {
parent::__construct();
foreach($fields as $field) {
$field->setForm($this);
}
foreach($fields as $field) $field->setForm($this);
foreach($actions as $action) $actions->setForm($this);
$this->fields = $fields;
@ -196,6 +204,15 @@ class Form extends ViewableData {
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.
* 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;
}
/**
* Setter for the form actions.
*
* @param FieldSet $actions
*/
function setActions($actions) {
$this->actions = $actions;
}
/**
* Unset all form actions
*/