Merge pull request #4032 from Icinga/feature/trigger-config-events-on-module-enable-and-disable
Trigger config events on enabling/disabling modules
This commit is contained in:
commit
c12da7b7ac
|
@ -160,6 +160,7 @@ class ConfigController extends Controller
|
|||
$module = $form->getValue('identifier');
|
||||
Icinga::app()->getModuleManager()->enableModule($module);
|
||||
Notification::success(sprintf($this->translate('Module "%s" enabled'), $module));
|
||||
$form->onSuccess();
|
||||
$this->rerenderLayout()->reloadCss()->redirectNow('config/modules');
|
||||
});
|
||||
|
||||
|
@ -185,6 +186,7 @@ class ConfigController extends Controller
|
|||
$module = $form->getValue('identifier');
|
||||
Icinga::app()->getModuleManager()->disableModule($module);
|
||||
Notification::success(sprintf($this->translate('Module "%s" disabled'), $module));
|
||||
$form->onSuccess();
|
||||
$this->rerenderLayout()->reloadCss()->redirectNow('config/modules');
|
||||
});
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
namespace Icinga\Forms;
|
||||
|
||||
use Icinga\Application\Hook\ConfigFormEventsHook;
|
||||
use Icinga\Web\Form;
|
||||
|
||||
class ActionForm extends Form
|
||||
|
@ -58,4 +59,20 @@ class ActionForm extends Form
|
|||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function isValid($formData)
|
||||
{
|
||||
$valid = parent::isValid($formData);
|
||||
|
||||
if ($valid) {
|
||||
$valid = ConfigFormEventsHook::runIsValid($this);
|
||||
}
|
||||
|
||||
return $valid;
|
||||
}
|
||||
|
||||
public function onSuccess()
|
||||
{
|
||||
ConfigFormEventsHook::runOnSuccess($this);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue