/** * Add action method * * @return void */ public function add() { $this->prepareView('tags/add.phtml'); $this->view->title = 'Tags : Add'; $this->view->form = new Form\Tag($this->application->config()['forms']['Phire\\Tags\\Form\\Tag']); if ($this->request->isPost()) { $this->view->form->addFilter('htmlentities', [ENT_QUOTES, 'UTF-8'])->setFieldValues($this->request->getPost()); if ($this->view->form->isValid()) { $this->view->form->clearFilters()->addFilter('html_entity_decode', [ENT_QUOTES, 'UTF-8'])->filter(); $tag = new Model\Tag(); $tag->save($this->view->form->getFields()); $this->view->id = $tag->id; $this->sess->setRequestValue('saved', true); $this->redirect(BASE_PATH . APP_URI . '/tags/edit/' . $tag->id); } } $this->send(); }