src/App/Form/Type/ContactType.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Form\Type;
  3. use EWZ\Bundle\RecaptchaBundle\Form\Type\EWZRecaptchaType;
  4. use EWZ\Bundle\RecaptchaBundle\Validator\Constraints\IsTrue as RecaptchaTrue;
  5. use Symfony\Component\Form\AbstractType;
  6. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  7. use Symfony\Component\Form\Extension\Core\Type\TelType;
  8. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  9. use Symfony\Component\Form\FormBuilderInterface;
  10. use Symfony\Component\OptionsResolver\OptionsResolver;
  11. class ContactType extends AbstractType
  12. {
  13.     public function buildForm(FormBuilderInterface $builder, array $options)
  14.     {
  15.         $builder
  16.             ->add('name')
  17.             ->add('company')
  18.             ->add('phone'TelType::class)
  19.             ->add('email'EmailType::class)
  20.             ->add('message'TextAreaType::class)
  21.             ->add('recaptcha'EWZRecaptchaType::class, [
  22.                 'attr'        => [
  23.                     'options' => [
  24.                         'theme' => 'light',
  25.                         'type'  => 'image',
  26.                         'size'  => 'normal'
  27.                     ]
  28.                 ],
  29.                 'mapped'      => false,
  30.                 'constraints' => [
  31.                     new RecaptchaTrue()
  32.                 ]
  33.             ]);
  34.         ;
  35.     }
  36.     public function configureOptions(OptionsResolver $resolver)
  37.     {
  38.         $resolver->setDefaults([
  39.             // Configure your form options here
  40.         ]);
  41.     }
  42. }