/** * @param LinkForm $form */ public function formSubmitted(LinkForm $form) { try { $this->linkManager->update($form->getValues()); $form->presenter->flashMessage('Link management was successful.', 'success'); } catch (\Nette\InvalidArgumentException $ex) { $form->addError($ex->getMessage()); } }
/** * @param $id */ public function handleDelete($id) { if (!$this->getUser()->isAllowed('Admin:Link', 'delete')) { $this->flashMessage('Access denied!'); } else { try { $this->linkManager->delete($id); } catch (\Nette\InvalidArgumentException $ex) { $this->flashMessage($ex->getMessage()); } } $this->redirect('this'); }