src/Form/ContactUsType.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use App\DTO\Contact;
  4. use Symfony\Component\Form\AbstractType;
  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. final class ContactUsType extends AbstractType
  12. {
  13.     /**
  14.      * @inheritDoc
  15.      */
  16.     public function buildForm(FormBuilderInterface $builder, array $options): void
  17.     {
  18.         $builder
  19.             ->add('name'TextType::class, [
  20.                 'label' => null,
  21.                 'attr' => [
  22.                     'placeholder' => 'contacts_us.placeholder_company',
  23.                 ]
  24.             ])
  25.             ->add('email'EmailType::class, [
  26.                 'label' => null,
  27.                 'attr' => [
  28.                     'placeholder' => 'contacts_us.placeholder_email',
  29.                 ],
  30.             ])
  31.             ->add('content'TextareaType::class, [
  32.                 'label' => null,
  33.                 'attr' => [
  34.                     'placeholder' => 'contacts_us.placeholder_message',
  35.                 ],
  36.             ])
  37.             ->add('submit'SubmitType::class, [
  38.                 'label' => 'contacts_us.button_send',
  39.                 'attr' => [
  40.                     'class' => 'btn-two',
  41.                 ],
  42.             ])
  43.         ;
  44.     }
  45.     /**
  46.      * @inheritDoc
  47.      */
  48.     public function configureOptions(OptionsResolver $resolver): void
  49.     {
  50.         $resolver->setDefaults([
  51.             'data_class' => Contact::class,
  52.             'csrf_protection' => false,
  53.             'attr' => [
  54.                 'autocomplete' => 'off',
  55.             ],
  56.         ]);
  57.     }
  58. }