NavigationController: Rerender the layout when adding a menu entry

refs #5600
This commit is contained in:
Johannes Meyer 2015-09-24 14:05:28 +02:00
parent 165dc00fad
commit c4df7e05be
1 changed files with 7 additions and 1 deletions

View File

@ -162,14 +162,20 @@ class NavigationController extends Controller
$form->setUser($this->Auth()->getUser());
$form->setShareConfig(Config::app('navigation'));
$form->setOnSuccess(function (NavigationConfigForm $form) {
$data = array_filter($form->getValues());
try {
$form->add(array_filter($form->getValues()));
$form->add($data);
} catch (Exception $e) {
$form->error($e->getMessage());
return false;
}
if ($form->save()) {
if (isset($data['type']) && $data['type'] === 'menu-item') {
$form->getResponse()->setRerenderLayout();
}
Notification::success(t('Navigation item successfully created'));
return true;
}