API Add onAfterSave extension point to GridFieldDetailForm_ItemRequest

This commit is contained in:
Damian Mooyman 2017-12-12 12:35:19 +13:00
parent a50fd009ca
commit 9170220d2c

View File

@ -44,7 +44,6 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler
protected $component; protected $component;
/** /**
*
* @var DataObject * @var DataObject
*/ */
protected $record; protected $record;
@ -161,7 +160,7 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler
* complete controller with gaps for extra functionality. This, for example, would be a better way * complete controller with gaps for extra functionality. This, for example, would be a better way
* of letting Security/login put its log-in form inside a UI specified elsewhere. * of letting Security/login put its log-in form inside a UI specified elsewhere.
* *
* @return Form * @return Form|HTTPResponse
*/ */
public function ItemEditForm() public function ItemEditForm()
{ {
@ -468,6 +467,8 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler
// Save form and any extra saved data into this dataobject // Save form and any extra saved data into this dataobject
$form->saveInto($this->record); $form->saveInto($this->record);
$this->record->write(); $this->record->write();
$this->extend('onAfterSave', $this->record);
$extraData = $this->getExtraSavedData($this->record, $list); $extraData = $this->getExtraSavedData($this->record, $list);
$list->add($this->record, $extraData); $list->add($this->record, $extraData);