Ejemplo n.º 1
0
 /**
  * Add action method
  *
  * @return void
  */
 public function add()
 {
     $this->prepareView('content/types/add.phtml');
     $this->view->title = 'Content : Types : Add';
     $fields = $this->application->config()['forms']['Phire\\Content\\Form\\ContentType'];
     $this->view->form = new Form\ContentType($fields);
     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();
             $type = new Model\ContentType();
             $type->save($this->view->form->getFields());
             $this->view->id = $type->id;
             $this->sess->setRequestValue('saved', true);
             $this->redirect(BASE_PATH . APP_URI . '/content/types/edit/' . $type->id);
         }
     }
     $this->send();
 }