public function processNewTag(Form $form, $values) { if (!$this->authorizator->isAllowed($this->user, 'page_tag', 'create')) { $this->flashMessage('authorization.noPermission', FlashMessage::WARNING); return; } try { $tag = $this->tagFacade->saveTag((array) $values); $this->onSuccessTagSaving($tag, $this); } catch (TagNameAlreadyExistsException $t) { $form->addError($this->translator->translate('tags.tagForm.messages.nameExists', ['name' => $values['name']])); } catch (UrlAlreadyExistsException $url) { $form->addError($this->translator->translate('tags.tagForm.messages.tagUrlExists')); } catch (DBALException $e) { $form->addError($this->translator->translate('tags.tagForm.messages.savingError')); } }
public function processTag(Form $form, $values) { if (!$this->authorizator->isAllowed($this->user, 'page_tag', 'edit')) { $this->flashMessage('authorization.noPermission', FlashMessage::WARNING); return; } try { $this->tagFacade->saveTag((array) $values, $this->tag); if ($this->presenter->isAjax()) { $this->redrawControl(); } else { $this->redirect('this#tag-' . $this->tag->getId()); } } catch (DBALException $e) { $this->flashMessage('tags.tagForm.messages.savingError', FlashMessage::ERROR, ['name' => $this->tag['name']]); if ($this->presenter->isAjax()) { $this->redrawControl('flashes'); } else { $this->redirect('this'); } } }