mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-01 05:39:10 +02:00
Add onPopulateFromPostData extension hook
This commit is contained in:
parent
73cfcc6791
commit
a9aefe38ea
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user