]>
Commit | Line | Data |
---|---|---|
152fcccd JB |
1 | <?php |
2 | ||
3 | namespace Wallabag\UserBundle\Form; | |
4 | ||
5 | use Symfony\Component\Form\AbstractType; | |
152fcccd | 6 | use Symfony\Component\Form\Extension\Core\Type\CheckboxType; |
f808b016 | 7 | use Symfony\Component\Form\Extension\Core\Type\EmailType; |
152fcccd JB |
8 | use Symfony\Component\Form\Extension\Core\Type\SubmitType; |
9 | use Symfony\Component\Form\Extension\Core\Type\TextType; | |
f808b016 JB |
10 | use Symfony\Component\Form\FormBuilderInterface; |
11 | use Symfony\Component\OptionsResolver\OptionsResolver; | |
152fcccd JB |
12 | |
13 | class UserType extends AbstractType | |
14 | { | |
15 | /** | |
16 | * @param FormBuilderInterface $builder | |
17 | * @param array $options | |
18 | */ | |
19 | public function buildForm(FormBuilderInterface $builder, array $options) | |
20 | { | |
21 | $builder | |
22 | ->add('name', TextType::class, [ | |
23 | 'required' => false, | |
24 | 'label' => 'user.form.name_label', | |
25 | ]) | |
26 | ->add('username', TextType::class, [ | |
27 | 'required' => true, | |
28 | 'label' => 'user.form.username_label', | |
29 | ]) | |
30 | ->add('email', EmailType::class, [ | |
31 | 'required' => true, | |
32 | 'label' => 'user.form.email_label', | |
33 | ]) | |
34 | ->add('enabled', CheckboxType::class, [ | |
35 | 'required' => false, | |
36 | 'label' => 'user.form.enabled_label', | |
37 | ]) | |
152fcccd JB |
38 | ->add('twoFactorAuthentication', CheckboxType::class, [ |
39 | 'required' => false, | |
40 | 'label' => 'user.form.twofactor_label', | |
41 | ]) | |
42 | ->add('save', SubmitType::class, [ | |
43 | 'label' => 'user.form.save', | |
44 | ]) | |
45 | ; | |
46 | } | |
47 | ||
48 | /** | |
49 | * @param OptionsResolver $resolver | |
50 | */ | |
51 | public function configureOptions(OptionsResolver $resolver) | |
52 | { | |
f808b016 | 53 | $resolver->setDefaults([ |
152fcccd | 54 | 'data_class' => 'Wallabag\UserBundle\Entity\User', |
f808b016 | 55 | ]); |
152fcccd JB |
56 | } |
57 | } |