src/Form/Type/Frontend/SaleAutoProType.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Form\Type\Frontend;
  3. use App\Form\Type\EWZRecaptchaCustomType;
  4. use Symfony\Component\Form\AbstractType;
  5. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  6. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  7. use Symfony\Component\Form\Extension\Core\Type\SubmitType;
  8. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  9. use Symfony\Component\Form\Extension\Core\Type\TextType;
  10. use Symfony\Component\Form\FormBuilderInterface;
  11. use Symfony\Component\OptionsResolver\OptionsResolver;
  12. use Symfony\Component\Validator\Constraints\Email;
  13. use Symfony\Component\Validator\Constraints\Length;
  14. use Symfony\Component\Validator\Constraints\NotBlank;
  15. class SaleAutoProType extends AbstractType
  16. {
  17.     public function buildForm(FormBuilderInterface $builder, array $options)
  18.     {
  19.         $builder
  20.             ->add('companyName'TextType::class, [
  21.                 'label' => 'frontend.landing.sale-auto-pro.form.label.company_name',
  22.                 'constraints' => [
  23.                     new NotBlank(),
  24.                 ],
  25.             ])
  26.             ->add('lastname'TextType::class, [
  27.                 'label' => 'frontend.landing.sale-auto-pro.form.label.lastname',
  28.                 'constraints' => [
  29.                     new NotBlank(),
  30.                 ],
  31.             ])
  32.             ->add('function'ChoiceType::class, [
  33.                 'label' => 'frontend.landing.sale-auto-pro.form.label.function',
  34.                 'required' => false,
  35.                 'choices' => [
  36.                     'frontend.landing.sale-auto-pro.form.business_role.choices.acheteur' => 'Acheteur',
  37.                     'frontend.landing.sale-auto-pro.form.business_role.choices.administratif' => 'Administratif',
  38.                     'frontend.landing.sale-auto-pro.form.business_role.choices.chef_ventes_vo' => 'Chef des ventes VO',
  39.                     'frontend.landing.sale-auto-pro.form.business_role.choices.comptabilite' => 'ComptabilitĂ©',
  40.                     'frontend.landing.sale-auto-pro.form.business_role.choices.gerant' => 'GĂ©rant',
  41.                     'frontend.landing.sale-auto-pro.form.business_role.choices.vendeur' => 'Vendeur',
  42.                     'frontend.landing.sale-auto-pro.form.business_role.choices.other' => 'Autre',
  43.                 ],
  44.             ])
  45.             ->add('tel'TextType::class, [
  46.                 'label' => 'frontend.landing.sale-auto-pro.form.label.tel',
  47.                 'constraints' => [
  48.                     new NotBlank(),
  49.                 ],
  50.             ])
  51.             ->add('email'EmailType::class, [
  52.                 'label' => 'frontend.landing.sale-auto-pro.form.label.email',
  53.                 'constraints' => [
  54.                     new NotBlank(),
  55.                     new Email(),
  56.                 ],
  57.             ])
  58.             ->add('message'TextareaType::class, [
  59.                 'label' => 'frontend.landing.sale-auto-pro.form.label.message',
  60.                 'constraints' => [
  61.                     new NotBlank(),
  62.                     new Length(['min' => 10]),
  63.                 ],
  64.             ])
  65.             ->add('recaptcha'EWZRecaptchaCustomType::class)
  66.             ->add('send'SubmitType::class, [
  67.                 'label' => 'frontend.landing.sale-auto-pro.form.label.submit',
  68.                 'attr' => [
  69.                     'class' => 'lien14 bg04',
  70.                 ],
  71.             ])
  72.         ;
  73.     }
  74.     public function configureOptions(OptionsResolver $resolver)
  75.     {
  76.         $resolver->setDefaults([
  77.             'translation_domain' => 'landing',
  78.         ]);
  79.     }
  80. }