]> git.immae.eu Git - github/wallabag/wallabag.git/blame - src/Wallabag/UserBundle/Form/UserType.php
Merge pull request #2731 from llune/patch-2
[github/wallabag/wallabag.git] / src / Wallabag / UserBundle / Form / UserType.php
CommitLineData
152fcccd
JB
1<?php
2
3namespace Wallabag\UserBundle\Form;
4
5use Symfony\Component\Form\AbstractType;
6use Symfony\Component\Form\FormBuilderInterface;
7use Symfony\Component\OptionsResolver\OptionsResolver;
8use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
9use Symfony\Component\Form\Extension\Core\Type\SubmitType;
10use Symfony\Component\Form\Extension\Core\Type\TextType;
11use Symfony\Component\Form\Extension\Core\Type\EmailType;
12
13class 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 {
53 $resolver->setDefaults(array(
54 'data_class' => 'Wallabag\UserBundle\Entity\User',
55 ));
56 }
57}