src/Form/Type/ContactFormType.php line 21

Open in your IDE?
  1. <?php
  2. /**
  3.  * Created by PhpStorm.
  4.  * User: michael
  5.  * Date: 27/12/2019
  6.  * Time: 17:13
  7.  */
  8. namespace App\Form\Type;
  9. use Symfony\Component\Form\AbstractType;
  10. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  11. use Symfony\Component\Form\Extension\Core\Type\SubmitType;
  12. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  13. use Symfony\Component\Form\Extension\Core\Type\TextType;
  14. use Symfony\Component\Form\Extension\Core\Type\UrlType;
  15. use Symfony\Component\Form\FormBuilderInterface;
  16. use Symfony\Component\OptionsResolver\OptionsResolver;
  17. class ContactFormType extends AbstractType
  18. {
  19.     public function buildForm(FormBuilderInterface $builder, array $options)
  20.     {
  21.         $builder
  22.             ->add('lastname'TextType::class, [
  23.                 'label' => false,
  24.                 'attr' => [
  25.                     'placeholder' => 'Nom'
  26.                 ]
  27.             ])
  28.             ->add('firstname'TextType::class, [
  29.                 'label' => false,
  30.                 'attr' => [
  31.                     'placeholder' => 'Prénom'
  32.                 ]
  33.             ])
  34.             ->add('email'EmailType::class, [
  35.                 'label' => false,
  36.                 'attr' => [
  37.                     'placeholder' => 'Email'
  38.                 ]
  39.             ])
  40.             ->add('phone'TextType::class, [
  41.                 'label' => false,
  42.                 'attr' => [
  43.                     'placeholder' => 'Téléphone',
  44.                     'class' => 'cleave-phone-number'
  45.                 ]
  46.             ])
  47.             ->add('society'TextType::class, [
  48.                 'label' => false,
  49.                 'attr' => [
  50.                     'placeholder' => 'Société'
  51.                 ]
  52.             ])
  53.             ->add('website'UrlType::class, [
  54.                 'label' => false,
  55.                 'attr' => [
  56.                     'placeholder' => 'Site Web'
  57.                 ]
  58.             ])
  59.             ->add('message'TextareaType::class, [
  60.                 'label' => false,
  61.                 'attr' => [
  62.                     'placeholder' => 'Comment pouvons-nous vous aider ?',
  63.                     'rows' => 5
  64.                 ]
  65.             ])
  66.             ->add('submit'SubmitType::class, [
  67.                 'label' => 'Envoyer',
  68.                 'attr' => [
  69.                     'class' => 'btn btn-primary w-100'
  70.                 ]
  71.             ])
  72.         ;
  73.     }
  74.     public function configureOptions(OptionsResolver $resolver)
  75.     {
  76.         $resolver->setDefaults(array(
  77.             'label' => false,
  78.             'attr' => [
  79.                 'id' => 'contact-form-mca'
  80.                 ]
  81.         ));
  82.     }
  83. }