src/AppBundle/Form/MediaFormType.php line 16

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace AppBundle\Form;
  4. use Symfony\Component\Form\AbstractType;
  5. use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
  6. use Symfony\Component\Form\Extension\Core\Type\SubmitType;
  7. use Symfony\Component\Form\Extension\Core\Type\TextType;
  8. use Symfony\Component\Form\FormBuilderInterface;
  9. use Symfony\Component\Validator\Constraints\IsTrue;
  10. use Symfony\Component\Validator\Constraints\Length;
  11. use Symfony\Component\Validator\Constraints\NotBlank;
  12. class MediaFormType extends AbstractType
  13. {
  14.     public function buildForm(FormBuilderInterface $builder, array $options): void
  15.     {
  16.         $builder
  17.             ->add('name'TextType::class, [
  18.                 'label' => 'app.general.gemini.mediaform.name',
  19.                 'required' => true,
  20.                 'constraints' => [
  21.                     new NotBlank(),
  22.                     new Length(['min' => 3]),
  23.                 ],
  24.             ])
  25.             ->add('surname'TextType::class, [
  26.                 'label' => 'app.general.gemini.mediaform.surname',
  27.                 'required' => true,
  28.                 'constraints' => [
  29.                     new NotBlank(),
  30.                     new Length(['min' => 3]),
  31.                 ],
  32.             ])
  33.             ->add('email'TextType::class, [
  34.                 'label' => 'app.general.gemini.mediaform.email',
  35.                 'required' => true,
  36.                 'constraints' => [
  37.                     new NotBlank(),
  38.                     new Length(['min' => 3]),
  39.                 ],
  40.             ])
  41.             ->add('phone'TextType::class, [
  42.                 'label' => 'app.general.gemini.mediaform.phone',
  43.                 'required' => false,
  44.             ])
  45.             ->add('company'TextType::class, [
  46.                 'label' => 'app.general.gemini.mediaform.company',
  47.                 'required' => false,
  48.             ])
  49.             ->add('topic'TextType::class, [
  50.                 'label' => 'app.general.gemini.mediaform.topic',
  51.                 'required' => false,
  52.             ])
  53.             ->add('message'TextType::class, [
  54.                 'label' => 'app.general.gemini.mediaform.message',
  55.                 'required' => true,
  56.                 'constraints' => [
  57.                     new NotBlank(),
  58.                     new Length(['min' => 3]),
  59.                 ],
  60.             ])
  61.             ->add('agreement1'CheckboxType::class, [
  62.                 'label' => 'app.general.gemini.mediaform.agreement1',
  63.                 'required' => true,
  64.                 'constraints' => [
  65.                     new IsTrue([
  66.                         'message' => 'app.general.gemini.form.checkboxvalidation',
  67.                     ]),
  68.                 ],
  69.             ])
  70.             ->add('_submit'SubmitType::class, [
  71.                 'label' => 'app.general.gemini.mediaform.submit',
  72.                 'attr' => [
  73.                     'class' => 'col-5 primary-btn orange-btn',
  74.                 ],
  75.             ]);
  76.     }
  77. }