aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Form
diff options
context:
space:
mode:
authorPaulino Michelazzo <paulino@michelazzo.com.br>2016-10-18 22:48:23 +0200
committerPaulino Michelazzo <paulino@michelazzo.com.br>2016-10-18 22:48:23 +0200
commit99731f0bb1f6fd2815eeb9af504ce86df927657b (patch)
treeb080efc608d2bbd52b77a4a0067402007f50c5a8 /src/Wallabag/CoreBundle/Form
parent3a3c6b866b52721431bed22426d9abfcd0d2dfe0 (diff)
parent7180aaed45dce62e40620a9e4b202526ebd6a3bb (diff)
downloadwallabag-99731f0bb1f6fd2815eeb9af504ce86df927657b.tar.gz
wallabag-99731f0bb1f6fd2815eeb9af504ce86df927657b.tar.zst
wallabag-99731f0bb1f6fd2815eeb9af504ce86df927657b.zip
Merge remote-tracking branch 'wallabag/master'
Diffstat (limited to 'src/Wallabag/CoreBundle/Form')
-rw-r--r--src/Wallabag/CoreBundle/Form/Type/ClientType.php44
-rw-r--r--src/Wallabag/CoreBundle/Form/Type/ConfigType.php3
-rw-r--r--src/Wallabag/CoreBundle/Form/Type/NewUserType.php58
3 files changed, 3 insertions, 102 deletions
diff --git a/src/Wallabag/CoreBundle/Form/Type/ClientType.php b/src/Wallabag/CoreBundle/Form/Type/ClientType.php
deleted file mode 100644
index 8b351e60..00000000
--- a/src/Wallabag/CoreBundle/Form/Type/ClientType.php
+++ /dev/null
@@ -1,44 +0,0 @@
1<?php
2
3namespace Wallabag\CoreBundle\Form\Type;
4
5use Symfony\Component\Form\AbstractType;
6use Symfony\Component\Form\CallbackTransformer;
7use Symfony\Component\Form\Extension\Core\Type\SubmitType;
8use Symfony\Component\Form\Extension\Core\Type\UrlType;
9use Symfony\Component\Form\FormBuilderInterface;
10use Symfony\Component\OptionsResolver\OptionsResolver;
11
12class ClientType extends AbstractType
13{
14 public function buildForm(FormBuilderInterface $builder, array $options)
15 {
16 $builder
17 ->add('redirect_uris', UrlType::class, ['required' => true, 'label' => 'developer.client.form.redirect_uris_label'])
18 ->add('save', SubmitType::class, ['label' => 'developer.client.form.save_label'])
19 ;
20
21 $builder->get('redirect_uris')
22 ->addModelTransformer(new CallbackTransformer(
23 function ($originalUri) {
24 return $originalUri;
25 },
26 function ($submittedUri) {
27 return [$submittedUri];
28 }
29 ))
30 ;
31 }
32
33 public function configureOptions(OptionsResolver $resolver)
34 {
35 $resolver->setDefaults([
36 'data_class' => 'Wallabag\ApiBundle\Entity\Client',
37 ]);
38 }
39
40 public function getBlockPrefix()
41 {
42 return 'client';
43 }
44}
diff --git a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php
index 7d25cc80..0bac2874 100644
--- a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php
+++ b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php
@@ -52,6 +52,9 @@ class ConfigType extends AbstractType
52 'choices' => array_flip($this->languages), 52 'choices' => array_flip($this->languages),
53 'label' => 'config.form_settings.language_label', 53 'label' => 'config.form_settings.language_label',
54 ]) 54 ])
55 ->add('pocket_consumer_key', null, [
56 'label' => 'config.form_settings.pocket_consumer_key_label',
57 ])
55 ->add('save', SubmitType::class, [ 58 ->add('save', SubmitType::class, [
56 'label' => 'config.form.save', 59 'label' => 'config.form.save',
57 ]) 60 ])
diff --git a/src/Wallabag/CoreBundle/Form/Type/NewUserType.php b/src/Wallabag/CoreBundle/Form/Type/NewUserType.php
deleted file mode 100644
index 6a6f63d1..00000000
--- a/src/Wallabag/CoreBundle/Form/Type/NewUserType.php
+++ /dev/null
@@ -1,58 +0,0 @@
1<?php
2
3namespace Wallabag\CoreBundle\Form\Type;
4
5use Symfony\Component\Form\AbstractType;
6use Symfony\Component\Form\Extension\Core\Type\EmailType;
7use Symfony\Component\Form\Extension\Core\Type\PasswordType;
8use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
9use Symfony\Component\Form\Extension\Core\Type\SubmitType;
10use Symfony\Component\Form\Extension\Core\Type\TextType;
11use Symfony\Component\Form\FormBuilderInterface;
12use Symfony\Component\OptionsResolver\OptionsResolver;
13use Symfony\Component\Validator\Constraints;
14
15class NewUserType extends AbstractType
16{
17 public function buildForm(FormBuilderInterface $builder, array $options)
18 {
19 $builder
20 ->add('username', TextType::class, [
21 'required' => true,
22 'label' => 'config.form_new_user.username_label',
23 ])
24 ->add('plainPassword', RepeatedType::class, [
25 'type' => PasswordType::class,
26 'invalid_message' => 'validator.password_must_match',
27 'first_options' => ['label' => 'config.form_new_user.password_label'],
28 'second_options' => ['label' => 'config.form_new_user.repeat_new_password_label'],
29 'constraints' => [
30 new Constraints\Length([
31 'min' => 8,
32 'minMessage' => 'validator.password_too_short',
33 ]),
34 new Constraints\NotBlank(),
35 ],
36 'label' => 'config.form_new_user.plain_password_label',
37 ])
38 ->add('email', EmailType::class, [
39 'label' => 'config.form_new_user.email_label',
40 ])
41 ->add('save', SubmitType::class, [
42 'label' => 'config.form.save',
43 ])
44 ;
45 }
46
47 public function configureOptions(OptionsResolver $resolver)
48 {
49 $resolver->setDefaults([
50 'data_class' => 'Wallabag\UserBundle\Entity\User',
51 ]);
52 }
53
54 public function getBlockPrefix()
55 {
56 return 'new_user';
57 }
58}