NavigationController: Rerender the layout when editing a menu entry

refs #5600
This commit is contained in:
Johannes Meyer 2015-09-24 14:05:57 +02:00
parent c4df7e05be
commit b7ef951e57

View File

@ -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;
} }