Skip to content

Commit ea31ba7

Browse files
authored
Merge pull request #33 from ivanhrytsaim/11864-Blog-autosave
11864-Blog-autosave
2 parents 4f1cbb3 + 83afba2 commit ea31ba7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Controller/Adminhtml/Actions.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,15 @@ public function _saveAction()
236236
}
237237
$model->addData($params);
238238

239+
$this->_eventManager->dispatch('magefan_' . $this->getRequest()->getModuleName() . '_' . $this->getRequest()->getControllerName() . '_form_before_save', ['model' => $model]);
240+
239241
$this->_beforeSave($model, $request);
240242
$model->save();
243+
241244
$this->_afterSave($model, $request);
242245

246+
$this->_eventManager->dispatch('magefan_' . $this->getRequest()->getModuleName() . '_' . $this->getRequest()->getControllerName() . '_form_after_save', ['model' => $model]);
247+
243248
$this->messageManager->addSuccess(__('%1 has been saved.', $model->getOwnTitle()));
244249
$this->_setFormData(false);
245250
} catch (\Magento\Framework\Exception\LocalizedException $e) {
@@ -521,6 +526,7 @@ protected function _getModel($load = true)
521526

522527
if ($id && $load) {
523528
$this->_model->load($id);
529+
$this->_eventManager->dispatch('magefan_' . $this->getRequest()->getModuleName() . '_' . $this->getRequest()->getControllerName() . '_form_load_model_after', ['model' => $this->_model]);
524530
}
525531
}
526532
return $this->_model;

0 commit comments

Comments
 (0)