mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-05 04:54:24 +02:00
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');
|
$module = $form->getValue('identifier');
|
||||||
Icinga::app()->getModuleManager()->enableModule($module);
|
Icinga::app()->getModuleManager()->enableModule($module);
|
||||||
Notification::success(sprintf($this->translate('Module "%s" enabled'), $module));
|
Notification::success(sprintf($this->translate('Module "%s" enabled'), $module));
|
||||||
|
$form->onSuccess();
|
||||||
$this->rerenderLayout()->reloadCss()->redirectNow('config/modules');
|
$this->rerenderLayout()->reloadCss()->redirectNow('config/modules');
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -185,6 +186,7 @@ class ConfigController extends Controller
|
|||||||
$module = $form->getValue('identifier');
|
$module = $form->getValue('identifier');
|
||||||
Icinga::app()->getModuleManager()->disableModule($module);
|
Icinga::app()->getModuleManager()->disableModule($module);
|
||||||
Notification::success(sprintf($this->translate('Module "%s" disabled'), $module));
|
Notification::success(sprintf($this->translate('Module "%s" disabled'), $module));
|
||||||
|
$form->onSuccess();
|
||||||
$this->rerenderLayout()->reloadCss()->redirectNow('config/modules');
|
$this->rerenderLayout()->reloadCss()->redirectNow('config/modules');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
namespace Icinga\Forms;
|
namespace Icinga\Forms;
|
||||||
|
|
||||||
|
use Icinga\Application\Hook\ConfigFormEventsHook;
|
||||||
use Icinga\Web\Form;
|
use Icinga\Web\Form;
|
||||||
|
|
||||||
class ActionForm extends 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…
x
Reference in New Issue
Block a user