Add onPopulateFromPostData extension hook

This commit is contained in:
Will Rossiter 2014-07-09 11:55:54 +12:00
parent 73cfcc6791
commit a9aefe38ea

View File

@ -337,14 +337,16 @@ class EditableFormField extends DataObject {
} }
/** /**
* How to save the data submitted in this field into * How to save the data submitted in this field into the database object
* the database object which this field represents. * which this field represents.
* *
* Any class's which call this should also call * Any class's which call this should also call
* {@link parent::populateFromPostData()} to ensure * {@link parent::populateFromPostData()} to ensure that this method is
* that this method is called * called
* *
* @access public * @access public
*
* @param array $data
*/ */
public function populateFromPostData($data) { public function populateFromPostData($data) {
$this->Title = (isset($data['Title'])) ? $data['Title']: ""; $this->Title = (isset($data['Title'])) ? $data['Title']: "";
@ -386,6 +388,7 @@ class EditableFormField extends DataObject {
$this->CustomRules = serialize($rules); $this->CustomRules = serialize($rules);
} }
$this->extend('onPopulateFromPostData', $data);
$this->write(); $this->write();
} }