src/Form/ContactUsType.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use Karser\Recaptcha3Bundle\Form\Recaptcha3Type;
  4. use Karser\Recaptcha3Bundle\Validator\Constraints\Recaptcha3;
  5. use Symfony\Component\Form\AbstractType;
  6. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  7. use Symfony\Component\Form\FormBuilderInterface;
  8. use Symfony\Component\OptionsResolver\OptionsResolver;
  9. class ContactUsType extends AbstractType
  10. {
  11.     public function buildForm(FormBuilderInterface $builder, array $options)
  12.     {
  13.         $builder
  14.             ->add('name')
  15.             ->add('email')
  16.             ->add('subject')
  17.             ->add('message'TextareaType::class)
  18.             ->add('captcha'Recaptcha3Type::class, [
  19.                 'constraints' => new Recaptcha3(['message' => 'There were problems with your captcha. Please try again or contact with support and provide following code(s): {{ errorCodes }}']),
  20.                 'action_name' => 'contact'
  21.             ])
  22.         ;
  23.     }
  24.     public function configureOptions(OptionsResolver $resolver)
  25.     {
  26.         $resolver->setDefaults([
  27.             // Configure your form options here
  28.         ]);
  29.     }
  30. }