コード例 #1
0
 public function add()
 {
     $this->setTitle('Add Contact', 'Contacts');
     $this->addBreadcrumb('Add', '/contact/add');
     if ($this->request->getMethod() == 'POST') {
         $contact = new Contact();
         $contact->setValues($this->getParams());
         $contact = $this->contactStore->save($contact);
         $data = ['model' => $contact, 'content_id' => $contact->getId(), 'content' => $contact->getFirstName() . ' ' . $contact->getLastName() . ' ' . $contact->getCompany()];
         Event::trigger('ContentPublished', $data);
         $this->redirect('/contact/edit/' . $contact->getId());
     }
     $this->view->form = $this->contactForm();
 }