Skip to content

Commit

Permalink
NavigationController: Rerender the layout when adding a menu entry
Browse files Browse the repository at this point in the history
refs #5600
  • Loading branch information
Johannes Meyer committed Sep 24, 2015
1 parent 165dc00 commit c4df7e0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion application/controllers/NavigationController.php
Expand Up @@ -162,14 +162,20 @@ public function addAction()
$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;
}
Expand Down

0 comments on commit c4df7e0

Please sign in to comment.