Skip to content

Commit

Permalink
Merge pull request #33 from ivanhrytsaim/11864-Blog-autosave
Browse files Browse the repository at this point in the history
11864-Blog-autosave
  • Loading branch information
magefan authored Oct 3, 2024
2 parents 4f1cbb3 + 83afba2 commit ea31ba7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Controller/Adminhtml/Actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,15 @@ public function _saveAction()
}
$model->addData($params);

$this->_eventManager->dispatch('magefan_' . $this->getRequest()->getModuleName() . '_' . $this->getRequest()->getControllerName() . '_form_before_save', ['model' => $model]);

$this->_beforeSave($model, $request);
$model->save();

$this->_afterSave($model, $request);

$this->_eventManager->dispatch('magefan_' . $this->getRequest()->getModuleName() . '_' . $this->getRequest()->getControllerName() . '_form_after_save', ['model' => $model]);

$this->messageManager->addSuccess(__('%1 has been saved.', $model->getOwnTitle()));
$this->_setFormData(false);
} catch (\Magento\Framework\Exception\LocalizedException $e) {
Expand Down Expand Up @@ -521,6 +526,7 @@ protected function _getModel($load = true)

if ($id && $load) {
$this->_model->load($id);
$this->_eventManager->dispatch('magefan_' . $this->getRequest()->getModuleName() . '_' . $this->getRequest()->getControllerName() . '_form_load_model_after', ['model' => $this->_model]);
}
}
return $this->_model;
Expand Down

0 comments on commit ea31ba7

Please sign in to comment.