mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-07 13:55:55 +01:00
Added a new onAdminSave event right before saving an object - #384
This commit is contained in:
@@ -18,6 +18,7 @@ use Grav\Common\Utils;
|
|||||||
use Grav\Common\Backup\ZipBackup;
|
use Grav\Common\Backup\ZipBackup;
|
||||||
use Grav\Common\Markdown\Parsedown;
|
use Grav\Common\Markdown\Parsedown;
|
||||||
use Grav\Common\Markdown\ParsedownExtra;
|
use Grav\Common\Markdown\ParsedownExtra;
|
||||||
|
use RocketTheme\Toolbox\Event\Event;
|
||||||
use RocketTheme\Toolbox\File\File;
|
use RocketTheme\Toolbox\File\File;
|
||||||
use RocketTheme\Toolbox\File\JsonFile;
|
use RocketTheme\Toolbox\File\JsonFile;
|
||||||
use Symfony\Component\Yaml\Yaml;
|
use Symfony\Component\Yaml\Yaml;
|
||||||
@@ -1134,6 +1135,9 @@ class AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($obj) {
|
if ($obj) {
|
||||||
|
// Event to manipulate data before saving the object
|
||||||
|
$this->grav->fireEvent('onAdminSave', new Event(['object' => &$obj]));
|
||||||
|
|
||||||
$obj->save(true);
|
$obj->save(true);
|
||||||
$this->admin->setMessage($this->admin->translate('PLUGIN_ADMIN.SUCCESSFULLY_SAVED'), 'info');
|
$this->admin->setMessage($this->admin->translate('PLUGIN_ADMIN.SUCCESSFULLY_SAVED'), 'info');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user