src/Form/ContactFormType.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use Symfony\Component\Form\AbstractType;
  4. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  5. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  6. use Symfony\Component\Form\Extension\Core\Type\SubmitType;
  7. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  8. use Symfony\Component\Form\Extension\Core\Type\TextType;
  9. use Symfony\Component\Form\FormBuilderInterface;
  10. use Symfony\Component\OptionsResolver\OptionsResolver;
  11. class ContactFormType extends AbstractType
  12. {
  13.     public function __construct()
  14.     {
  15.     }
  16.     public function buildForm(FormBuilderInterface $builder, array $options)
  17.     {
  18.         $builder
  19.             ->add('first_name'TextType::class, [
  20.                 'attr' => ['placeholder' => 'Prénom']
  21.             ])
  22.             ->add('last_name'TextType::class, [
  23.                 'attr' => ['placeholder' => 'Nom']
  24.             ])
  25.             ->add('mail'EmailType::class, [
  26.                 'attr' => ['placeholder' => 'Email']
  27.             ])
  28.             ->add('phone'TextType::class, [
  29.                 'attr' => ['placeholder' => 'Téléphone'],
  30.                 'required' => false,
  31.             ])
  32.             ->add('subject'TextType::class, [
  33.                 'attr' => ['placeholder' => 'Sujet'],
  34.                 'required' => false
  35.             ])
  36.             ->add('help'TextareaType::class, [
  37.                 'attr' => ['placeholder' => 'Message']
  38.             ])
  39.             ->add('submit'SubmitType::class)
  40.         ;
  41.     }
  42.     public function configureOptions(OptionsResolver $resolver)
  43.     {
  44.         $resolver->setDefaults([]);
  45.     }
  46. }