mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-25 14:54:24 +02:00
NavigationController: Rerender the layout when editing a menu entry
refs #5600
This commit is contained in:
parent
c4df7e05be
commit
b7ef951e57
@ -203,13 +203,15 @@ class NavigationController extends Controller
|
|||||||
$form->setUser($this->Auth()->getUser());
|
$form->setUser($this->Auth()->getUser());
|
||||||
$form->setShareConfig(Config::app('navigation'));
|
$form->setShareConfig(Config::app('navigation'));
|
||||||
$form->setOnSuccess(function (NavigationConfigForm $form) use ($itemName) {
|
$form->setOnSuccess(function (NavigationConfigForm $form) use ($itemName) {
|
||||||
|
$data = array_map(
|
||||||
|
function ($v) {
|
||||||
|
return $v !== '' ? $v : null;
|
||||||
|
},
|
||||||
|
$form->getValues()
|
||||||
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$form->edit($itemName, array_map(
|
$form->edit($itemName, $data);
|
||||||
function ($v) {
|
|
||||||
return $v !== '' ? $v : null;
|
|
||||||
},
|
|
||||||
$form->getValues()
|
|
||||||
));
|
|
||||||
} catch (NotFoundError $e) {
|
} catch (NotFoundError $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
@ -218,6 +220,10 @@ class NavigationController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($form->save()) {
|
if ($form->save()) {
|
||||||
|
if (isset($data['type']) && $data['type'] === 'menu-item') {
|
||||||
|
$form->getResponse()->setRerenderLayout();
|
||||||
|
}
|
||||||
|
|
||||||
Notification::success(sprintf(t('Navigation item "%s" successfully updated'), $itemName));
|
Notification::success(sprintf(t('Navigation item "%s" successfully updated'), $itemName));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user