src/Form/RegistrationType.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use App\Entity\User;
  4. use Symfony\Component\Form\AbstractType;
  5. use Symfony\Component\Form\FormBuilderInterface;
  6. use Symfony\Component\OptionsResolver\OptionsResolver;
  7. use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
  8. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  9. use Symfony\Component\Form\Extension\Core\Type\SubmitType;
  10. use Symfony\Component\Form\Extension\Core\Type\TextType;
  11. use Symfony\Component\Form\Extension\Core\Type\PasswordType;
  12. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  13. class RegistrationType extends AbstractType
  14. {
  15.     /**
  16.      * {@inheritdoc}
  17.      */
  18.     public function buildForm(FormBuilderInterface $builder, array $options)
  19.     {
  20.         $builder->add('username'TextType::class, [
  21.             'label' => 'Meno:',
  22.             'attr' => [
  23.                 'class' => 'form-control',
  24.             ]
  25.         ])
  26.             ->add('password'PasswordType::class, [
  27.                 'label' => 'Heslo:',
  28.                 'attr' => [
  29.                     'class' => 'form-control',
  30.                 ]
  31.             ])
  32.             ->add('email'EmailType::class, [
  33.                 'label' => 'E-mail:',
  34.                 'required' => true,
  35.                 'attr' => [
  36. //                        'value' => 'mail@mail.com',
  37.                     'class' => 'form-control',
  38.                 ]
  39.             ])
  40.             ->add('address'TextType::class, [
  41.                 'label' => false,
  42.                 'required' => true,
  43.                 'mapped' => false,
  44.                 'attr' => [
  45.                     'value' => '',
  46. //                        'style' => 'display:none;'
  47.                 ]
  48.             ])
  49. //            ->add('gdpr', CheckboxType::class, [
  50. //                'label' => false,
  51. //                'required' => true,
  52. //                'mapped' => false,
  53. //            ])
  54.         ;
  55.     }
  56.     /**
  57.      * {@inheritdoc}
  58.      */
  59.     public function configureOptions(OptionsResolver $resolver)
  60.     {
  61.         $resolver->setDefaults(array(
  62.             'data_class' => User::class
  63.         ));
  64.     }
  65.     /**
  66.      * {@inheritdoc}
  67.      */
  68.     public function getBlockPrefix()
  69.     {
  70.         return 'registration';
  71.     }
  72. }