]> git.immae.eu Git - github/wallabag/wallabag.git/blob - src/Wallabag/UserBundle/Form/UserType.php
Fixed typo in "first_steps"
[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\FormBuilderInterface;
7 use Symfony\Component\OptionsResolver\OptionsResolver;
8 use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
9 use Symfony\Component\Form\Extension\Core\Type\SubmitType;
10 use Symfony\Component\Form\Extension\Core\Type\TextType;
11 use Symfony\Component\Form\Extension\Core\Type\EmailType;
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('locked', CheckboxType::class, [
39 'required' => false,
40 'label' => 'user.form.locked_label',
41 ])
42 ->add('twoFactorAuthentication', CheckboxType::class, [
43 'required' => false,
44 'label' => 'user.form.twofactor_label',
45 ])
46 ->add('save', SubmitType::class, [
47 'label' => 'user.form.save',
48 ])
49 ;
50 }
51
52 /**
53 * @param OptionsResolver $resolver
54 */
55 public function configureOptions(OptionsResolver $resolver)
56 {
57 $resolver->setDefaults(array(
58 'data_class' => 'Wallabag\UserBundle\Entity\User',
59 ));
60 }
61 }