Example #1
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('title', 'choice', array('choices' => Contact::getTitles(), 'expanded' => true, 'label' => 'mremi_contact.form.title'))->add('firstName', 'text', array('label' => 'mremi_contact.form.first_name'))->add('lastName', 'text', array('label' => 'mremi_contact.form.last_name'))->add('email', 'email', array('label' => 'mremi_contact.form.email'));
     if ($subjects = $this->subjectProvider->getSubjects()) {
         $builder->add('subject', 'choice', array('choices' => $subjects, 'label' => 'mremi_contact.form.subject'));
     } else {
         $builder->add('subject', 'text', array('label' => 'mremi_contact.form.subject'));
     }
     $builder->add('message', 'textarea', array('label' => 'mremi_contact.form.message'));
     if ($this->captchaType) {
         $builder->add('captcha', $this->captchaType, array('label' => 'mremi_contact.form.captcha'));
     }
     $builder->add('save', 'submit', array('label' => 'mremi_contact.form_submit'));
 }
Example #2
0
 /**
  * Tests the getTitles method.
  */
 public function testGetTitles()
 {
     $titles = Contact::getTitles();
     $this->assertTrue(is_array($titles));
     $this->assertCount(2, $titles);
 }