src/Bidcoz/Bundle/UserBundle/Form/Type/RegistrationFormType.php line 21

Open in your IDE?
  1. <?php
  2. namespace Bidcoz\Bundle\UserBundle\Form\Type;
  3. use Bidcoz\Bundle\CoreBundle\Form\Type\TimezoneType;
  4. use Karser\Recaptcha3Bundle\Form\Recaptcha3Type;
  5. use Karser\Recaptcha3Bundle\Validator\Constraints\Recaptcha3;
  6. use RS\DiExtraBundle\Annotation as DI;
  7. use Symfony\Component\Form\AbstractType;
  8. use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
  9. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  10. use Symfony\Component\Form\Extension\Core\Type\PasswordType;
  11. use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
  12. use Symfony\Component\Form\Extension\Core\Type\TextType;
  13. use Symfony\Component\Form\FormBuilderInterface;
  14. use Symfony\Component\OptionsResolver\OptionsResolver;
  15. /**
  16.  * @DI\FormType
  17.  */
  18. class RegistrationFormType extends AbstractType
  19. {
  20.     public function buildForm(FormBuilderInterface $builder, array $options)
  21.     {
  22.         $builder
  23.             ->remove('username')
  24.             ->add('firstName'TextType::class, [
  25.                 'label' => 'First Name:',
  26.                 'attr' => [
  27.                     'placeholder' => 'First Name',
  28.                 ],
  29.             ])
  30.             ->add('lastName'TextType::class, [
  31.                 'label' => 'Last Name:',
  32.                 'attr' => [
  33.                     'placeholder' => 'Last Name',
  34.                 ],
  35.             ])
  36.             ->add('phone'TextType::class, [
  37.                 'required' => false,
  38.                 'label'    => '*Mobile Phone Number:',
  39.                 'attr'     => [
  40.                     'class' => 'intl-phone',
  41.                 ],
  42.             ])
  43.             ->add('smsOptIn'CheckboxType::class, [
  44.                 'required' => false,
  45.                 'label'    => 'By checking this box, I agree to receive SMS text messages to the phone number provided regarding my activity in the fundraisers I am participating in.',
  46.             ])
  47.             ->add('timezone'TimezoneType::class)
  48.             ->add('acceptTerms'CheckboxType::class, [
  49.                 'required' => true,
  50.                 'label'    => 'I agree to the Bidcoz User Terms of Use',
  51.             ])
  52.             ->add('plainPassword'PasswordType::class, [
  53.                 'required'        => true,
  54.                 'attr' => [
  55.                     'placeholder' => 'Password',
  56.                 ],
  57.             ])
  58.             ->add('email'EmailType::class, [
  59.                 'label' => 'Email:',
  60.                 'attr' => [
  61.                     'placeholder' => 'Email Address',
  62.                 ],
  63.             ])
  64.             ->add('captcha'Recaptcha3Type::class, [
  65.                 'constraints' => new Recaptcha3(),
  66.                 'action_name' => 'registration',
  67.             ])
  68.         ;
  69.     }
  70.     public function getParent()
  71.     {
  72.         return \FOS\UserBundle\Form\Type\RegistrationFormType::class;
  73.     }
  74.     /**
  75.      * {@inheritdoc}
  76.      */
  77.     public function configureOptions(OptionsResolver $resolver)
  78.     {
  79.         $resolver->setDefaults([
  80.             'csrf_token_id' => 'registration',
  81.         ]);
  82.     }
  83.     public function getName()
  84.     {
  85.         return 'bidcoz_user_registration';
  86.     }
  87. }