]> git.immae.eu Git - github/wallabag/wallabag.git/blob - src/Wallabag/UserBundle/Form/UserType.php
Add a real configuration for CS-Fixer
[github/wallabag/wallabag.git] / src / Wallabag / UserBundle / Form / UserType.php
1 <?php
2
3 namespace Wallabag\UserBundle\Form;
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 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 ])
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 {
53 $resolver->setDefaults([
54 'data_class' => 'Wallabag\UserBundle\Entity\User',
55 ]);
56 }
57 }