src/Form/ContactType.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use Symfony\Component\Form\AbstractType;
  4. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  5. use Symfony\Component\Form\Extension\Core\Type\SubmitType;
  6. use Symfony\Component\Form\Extension\Core\Type\TextType;
  7. use Symfony\Component\Form\FormBuilderInterface;
  8. use Symfony\Component\OptionsResolver\OptionsResolver;
  9. class ContactType extends AbstractType
  10. {
  11.     public function buildForm(FormBuilderInterface $builder, array $options)
  12.     {
  13.         $builder
  14.             ->add('email'null, ['label' => false'required' => false])
  15.             ->add('subject'null, ['label' => false'required' => false])
  16.             ->add('message'null, ['label' => false'required' => false])
  17.             ->add('recaptcha'ReCaptchaType::class, [
  18.                 'type' => 'checkbox' // (invisible, checkbox)
  19.             ]);
  20.             // ->add('valid', SubmitType::class);
  21.     }
  22.     public function configureOptions(OptionsResolver $resolver)
  23.     {
  24.         $resolver->setDefault('attr', [
  25.             'novalidate' => true
  26.         ]);
  27.     }
  28. }