Added a new onAdminSave event right before saving an object - #384

This commit is contained in:
Andy Miller
2016-01-14 17:59:00 -07:00
parent 585b83d6a7
commit 2725c14334

View File

@@ -18,6 +18,7 @@ use Grav\Common\Utils;
use Grav\Common\Backup\ZipBackup;
use Grav\Common\Markdown\Parsedown;
use Grav\Common\Markdown\ParsedownExtra;
use RocketTheme\Toolbox\Event\Event;
use RocketTheme\Toolbox\File\File;
use RocketTheme\Toolbox\File\JsonFile;
use Symfony\Component\Yaml\Yaml;
@@ -1134,6 +1135,9 @@ class AdminController
}
if ($obj) {
// Event to manipulate data before saving the object
$this->grav->fireEvent('onAdminSave', new Event(['object' => &$obj]));
$obj->save(true);
$this->admin->setMessage($this->admin->translate('PLUGIN_ADMIN.SUCCESSFULLY_SAVED'), 'info');
}