]>
Commit | Line | Data |
---|---|---|
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('twoFactorAuthentication', CheckboxType::class, [ | |
25 | 'required' => false, | |
26 | 'label' => 'config.form_user.twoFactorAuthentication_label', | |
27 | ]) | |
28 | ->add('save', SubmitType::class, [ | |
29 | 'label' => 'config.form.save', | |
30 | ]) | |
31 | ->remove('username') | |
32 | ->remove('plainPassword') | |
33 | ; | |
34 | } | |
35 | ||
36 | public function getParent() | |
37 | { | |
38 | return 'FOS\UserBundle\Form\Type\RegistrationFormType'; | |
39 | } | |
40 | ||
41 | public function configureOptions(OptionsResolver $resolver) | |
42 | { | |
43 | $resolver->setDefaults([ | |
44 | 'data_class' => 'Wallabag\UserBundle\Entity\User', | |
45 | ]); | |
46 | } | |
47 | ||
48 | public function getBlockPrefix() | |
49 | { | |
50 | return 'update_user'; | |
51 | } | |
52 | } |