]> git.immae.eu Git - github/wallabag/wallabag.git/blob - src/Wallabag/CoreBundle/Form/Type/UserInformationType.php
Merge remote-tracking branch 'origin/master' into 2.4
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Form / Type / UserInformationType.php
1 <?php
2
3 namespace Wallabag\CoreBundle\Form\Type;
4
5 use Symfony\Component\Form\AbstractType;
6 use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
7 use Symfony\Component\Form\Extension\Core\Type\EmailType;
8 use Symfony\Component\Form\Extension\Core\Type\SubmitType;
9 use Symfony\Component\Form\Extension\Core\Type\TextType;
10 use Symfony\Component\Form\FormBuilderInterface;
11 use Symfony\Component\OptionsResolver\OptionsResolver;
12
13 class UserInformationType extends AbstractType
14 {
15 public function buildForm(FormBuilderInterface $builder, array $options)
16 {
17 $builder
18 ->add('name', TextType::class, [
19 'label' => 'config.form_user.name_label',
20 ])
21 ->add('email', EmailType::class, [
22 'label' => 'config.form_user.email_label',
23 ])
24 ->add('emailTwoFactor', CheckboxType::class, [
25 'required' => false,
26 'label' => 'config.form_user.emailTwoFactor_label',
27 ])
28 ->add('googleTwoFactor', CheckboxType::class, [
29 'required' => false,
30 'label' => 'config.form_user.googleTwoFactor_label',
31 'mapped' => false,
32 ])
33 ->add('save', SubmitType::class, [
34 'label' => 'config.form.save',
35 ])
36 ->remove('username')
37 ->remove('plainPassword')
38 ;
39 }
40
41 public function getParent()
42 {
43 return 'FOS\UserBundle\Form\Type\RegistrationFormType';
44 }
45
46 public function configureOptions(OptionsResolver $resolver)
47 {
48 $resolver->setDefaults([
49 'data_class' => 'Wallabag\UserBundle\Entity\User',
50 ]);
51 }
52
53 public function getBlockPrefix()
54 {
55 return 'update_user';
56 }
57 }