src/Hitso/Bundle/TicketsBundle/Form/Type/ContactType.php line 14

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Hitso\Bundle\TicketsBundle\Form\Type;
  4. use Symfony\Component\Form\AbstractType;
  5. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  6. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  7. use Symfony\Component\Form\Extension\Core\Type\TextType;
  8. use Symfony\Component\Form\FormBuilderInterface;
  9. use Symfony\Component\OptionsResolver\OptionsResolver;
  10. class ContactType extends AbstractType
  11. {
  12.     public function buildForm(FormBuilderInterface $builder, array $options): void
  13.     {
  14.         $builder
  15.             ->add(
  16.                 'authorFirstName',
  17.                 TextType::class,
  18.                 [
  19.                     'label'    => 'Imię',
  20.                     'required' => false,
  21.                     'attr'     => [
  22.                         'v-model' => 'fields.firstName',
  23.                         '@change' => 'checkLength($event, 255, "firstName")',
  24.                     ],
  25.                 ]
  26.             )
  27.             ->add(
  28.                 'authorLastName',
  29.                 TextType::class,
  30.                 [
  31.                     'label'    => 'Nazwisko',
  32.                     'required' => false,
  33.                     'attr'     => [
  34.                         'v-model' => 'fields.lastName',
  35.                         '@change' => 'checkLength($event, 255, "lastName")',
  36.                     ],
  37.                 ]
  38.             )
  39.             ->add(
  40.                 'authorEmail',
  41.                 EmailType::class,
  42.                 [
  43.                     'label'    => 'E-mail',
  44.                     'required' => false,
  45.                     'attr'     => [
  46.                         'v-model' => 'fields.email',
  47.                         '@change' => 'checkEmail($event, "email")',
  48.                     ],
  49.                 ]
  50.             )
  51.             ->add(
  52.                 'name',
  53.                 TextType::class,
  54.                 [
  55.                     'label'    => 'Temat',
  56.                     'required' => false,
  57.                     'attr'     => [
  58.                         'v-model' => 'fields.name',
  59.                         '@change' => 'checkLength($event, 255, "name")',
  60.                     ],
  61.                 ]
  62.             )
  63.             ->add(
  64.                 'content',
  65.                 TextareaType::class,
  66.                 [
  67.                     'label'      => 'Wiadomość',
  68.                     'attr'       => [
  69.                         'rows'    => 5,
  70.                         'v-model' => 'fields.message',
  71.                     ],
  72.                     'required'   => false,
  73.                     'empty_data' => ' ',
  74.                 ]
  75.             );
  76.     }
  77.     public function configureOptions(OptionsResolver $resolver): void
  78.     {
  79.         $resolver->setDefaults([
  80.             'translation_domain' => 'admin',
  81.             'topics'             => [],
  82.         ]);
  83.     }
  84. }