src/Form/Web/ContactType.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Form\Web;
  3. use Symfony\Component\Form\AbstractType;
  4. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  5. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  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): void
  12. {
  13. $builder
  14. ->add('name',TextType::class,[
  15. 'label' => 'contact.form.name',
  16. 'translation_domain' => 'web',
  17. 'required' => true,
  18. 'attr'=>[
  19. 'placeholder' => 'contact.form.name',
  20. 'class' => 'wpcf7-form-control wpcf7-text wpcf7-validates-as-required'
  21. ]
  22. ])
  23. ->add('email',EmailType::class,[
  24. 'label' => 'contact.form.email',
  25. 'translation_domain' => 'web',
  26. 'required' => true,
  27. 'attr' => [
  28. 'placeholder' => 'contact.form.email',
  29. 'class' => 'wpcf7-form-control wpcf7-text wpcf7-email wpcf7-validates-as-required wpcf7-validates-as-email'
  30. ]
  31. ])
  32. ->add('text',TextareaType::class,[
  33. 'label' => 'contact.form.text',
  34. 'translation_domain' => 'web',
  35. 'required' => true,
  36. 'attr'=>[
  37. 'placeholder' => 'contact.form.text',
  38. 'class' => 'wpcf7-form-control wpcf7-textarea',
  39. 'rows'=> 10
  40. ]
  41. ])
  42. ->add('website', TextType::class, [
  43. 'label' => false,
  44. 'mapped' => false,
  45. 'required' => false,
  46. 'attr' => [
  47. 'autocomplete' => 'off',
  48. 'tabindex' => '-1',
  49. ],
  50. ])
  51. ;
  52. }
  53. public function configureOptions(OptionsResolver $resolver): void
  54. {
  55. $resolver->setDefaults([
  56. // Configure your form options here
  57. ]);
  58. }
  59. }