예제 #1
0
 /**
  * @Route("/contact", name="_demo_contact")
  * @Template()
  */
 public function contactAction()
 {
     $form = ContactForm::create($this->get('form.context'), 'contact');
     $form->bind($this->container->get('request'), $form);
     if ($form->isValid()) {
         $form->send($this->get('mailer'));
         $this->get('session')->setFlash('notice', 'Message sent!');
         return new RedirectResponse($this->generateUrl('_demo'));
     }
     return array('form' => $form);
 }
 public function ContactForm()
 {
     // http://doc.silverstripe.org/framework/en/3.1/topics/forms
     return ContactForm::create($this, "ContactForm");
 }
 /** 
  * Creates a {@link ContactForm} object based on the data configured in the CMS.
  * Note: does not render the form. Returns the proxy {@link ContactForm} object
  *
  * @return ContactForm
  */
 public function Form()
 {
     return ContactForm::create("Form", $this->To, $this->Subject)->setSuccessMessage($this->SuccessMessage)->setIntroText($this->IntroText);
 }