diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Form/Type')
9 files changed, 63 insertions, 38 deletions
diff --git a/src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php b/src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php index 82e1954d..7d05a5d8 100644 --- a/src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php +++ b/src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php | |||
@@ -3,6 +3,9 @@ | |||
3 | namespace Wallabag\CoreBundle\Form\Type; | 3 | namespace Wallabag\CoreBundle\Form\Type; |
4 | 4 | ||
5 | use Symfony\Component\Form\AbstractType; | 5 | use Symfony\Component\Form\AbstractType; |
6 | use Symfony\Component\Form\Extension\Core\Type\PasswordType; | ||
7 | use Symfony\Component\Form\Extension\Core\Type\RepeatedType; | ||
8 | use Symfony\Component\Form\Extension\Core\Type\SubmitType; | ||
6 | use Symfony\Component\Form\FormBuilderInterface; | 9 | use Symfony\Component\Form\FormBuilderInterface; |
7 | use Symfony\Component\Security\Core\Validator\Constraints\UserPassword; | 10 | use Symfony\Component\Security\Core\Validator\Constraints\UserPassword; |
8 | use Symfony\Component\Validator\Constraints; | 11 | use Symfony\Component\Validator\Constraints; |
@@ -12,11 +15,11 @@ class ChangePasswordType extends AbstractType | |||
12 | public function buildForm(FormBuilderInterface $builder, array $options) | 15 | public function buildForm(FormBuilderInterface $builder, array $options) |
13 | { | 16 | { |
14 | $builder | 17 | $builder |
15 | ->add('old_password', 'password', array( | 18 | ->add('old_password', PasswordType::class, array( |
16 | 'constraints' => new UserPassword(array('message' => 'Wrong value for your current password')), | 19 | 'constraints' => new UserPassword(array('message' => 'Wrong value for your current password')), |
17 | )) | 20 | )) |
18 | ->add('new_password', 'repeated', array( | 21 | ->add('new_password', RepeatedType::class, array( |
19 | 'type' => 'password', | 22 | 'type' => PasswordType::class, |
20 | 'invalid_message' => 'The password fields must match.', | 23 | 'invalid_message' => 'The password fields must match.', |
21 | 'required' => true, | 24 | 'required' => true, |
22 | 'first_options' => array('label' => 'New password'), | 25 | 'first_options' => array('label' => 'New password'), |
@@ -29,11 +32,11 @@ class ChangePasswordType extends AbstractType | |||
29 | new Constraints\NotBlank(), | 32 | new Constraints\NotBlank(), |
30 | ), | 33 | ), |
31 | )) | 34 | )) |
32 | ->add('save', 'submit') | 35 | ->add('save', SubmitType::class) |
33 | ; | 36 | ; |
34 | } | 37 | } |
35 | 38 | ||
36 | public function getName() | 39 | public function getBlockPrefix() |
37 | { | 40 | { |
38 | return 'change_passwd'; | 41 | return 'change_passwd'; |
39 | } | 42 | } |
diff --git a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php index 1f0ad89d..a139f2df 100644 --- a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php +++ b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php | |||
@@ -3,6 +3,8 @@ | |||
3 | namespace Wallabag\CoreBundle\Form\Type; | 3 | namespace Wallabag\CoreBundle\Form\Type; |
4 | 4 | ||
5 | use Symfony\Component\Form\AbstractType; | 5 | use Symfony\Component\Form\AbstractType; |
6 | use Symfony\Component\Form\Extension\Core\Type\ChoiceType; | ||
7 | use Symfony\Component\Form\Extension\Core\Type\SubmitType; | ||
6 | use Symfony\Component\Form\FormBuilderInterface; | 8 | use Symfony\Component\Form\FormBuilderInterface; |
7 | use Symfony\Component\OptionsResolver\OptionsResolver; | 9 | use Symfony\Component\OptionsResolver\OptionsResolver; |
8 | 10 | ||
@@ -28,15 +30,16 @@ class ConfigType extends AbstractType | |||
28 | public function buildForm(FormBuilderInterface $builder, array $options) | 30 | public function buildForm(FormBuilderInterface $builder, array $options) |
29 | { | 31 | { |
30 | $builder | 32 | $builder |
31 | ->add('theme', 'choice', array( | 33 | ->add('theme', ChoiceType::class, array( |
32 | 'choices' => array_flip($this->themes), | 34 | 'choices' => array_flip($this->themes), |
33 | 'choices_as_values' => true, | 35 | 'choices_as_values' => true, |
34 | )) | 36 | )) |
35 | ->add('items_per_page') | 37 | ->add('items_per_page') |
36 | ->add('language', 'choice', array( | 38 | ->add('language', ChoiceType::class, array( |
37 | 'choices' => $this->languages, | 39 | 'choices' => array_flip($this->languages), |
40 | 'choices_as_values' => true, | ||
38 | )) | 41 | )) |
39 | ->add('save', 'submit') | 42 | ->add('save', SubmitType::class) |
40 | ; | 43 | ; |
41 | } | 44 | } |
42 | 45 | ||
@@ -47,7 +50,7 @@ class ConfigType extends AbstractType | |||
47 | )); | 50 | )); |
48 | } | 51 | } |
49 | 52 | ||
50 | public function getName() | 53 | public function getBlockPrefix() |
51 | { | 54 | { |
52 | return 'config'; | 55 | return 'config'; |
53 | } | 56 | } |
diff --git a/src/Wallabag/CoreBundle/Form/Type/EditEntryType.php b/src/Wallabag/CoreBundle/Form/Type/EditEntryType.php index 0fa4b71f..0cb29881 100644 --- a/src/Wallabag/CoreBundle/Form/Type/EditEntryType.php +++ b/src/Wallabag/CoreBundle/Form/Type/EditEntryType.php | |||
@@ -3,6 +3,9 @@ | |||
3 | namespace Wallabag\CoreBundle\Form\Type; | 3 | namespace Wallabag\CoreBundle\Form\Type; |
4 | 4 | ||
5 | use Symfony\Component\Form\AbstractType; | 5 | use Symfony\Component\Form\AbstractType; |
6 | use Symfony\Component\Form\Extension\Core\Type\CheckboxType; | ||
7 | use Symfony\Component\Form\Extension\Core\Type\SubmitType; | ||
8 | use Symfony\Component\Form\Extension\Core\Type\TextType; | ||
6 | use Symfony\Component\Form\FormBuilderInterface; | 9 | use Symfony\Component\Form\FormBuilderInterface; |
7 | use Symfony\Component\OptionsResolver\OptionsResolver; | 10 | use Symfony\Component\OptionsResolver\OptionsResolver; |
8 | 11 | ||
@@ -11,14 +14,14 @@ class EditEntryType extends AbstractType | |||
11 | public function buildForm(FormBuilderInterface $builder, array $options) | 14 | public function buildForm(FormBuilderInterface $builder, array $options) |
12 | { | 15 | { |
13 | $builder | 16 | $builder |
14 | ->add('title', 'text', array('required' => true)) | 17 | ->add('title', TextType::class, array('required' => true)) |
15 | ->add('is_public', 'checkbox', array('required' => false)) | 18 | ->add('is_public', CheckboxType::class, array('required' => false)) |
16 | // @todo: add autocomplete | 19 | // @todo: add autocomplete |
17 | // ->add('tags', 'entity', array( | 20 | // ->add('tags', 'entity', array( |
18 | // 'class' => 'Wallabag\CoreBundle\Entity\Tag', | 21 | // 'class' => 'Wallabag\CoreBundle\Entity\Tag', |
19 | // 'choice_translation_domain' => true, | 22 | // 'choice_translation_domain' => true, |
20 | // )) | 23 | // )) |
21 | ->add('save', 'submit') | 24 | ->add('save', SubmitType::class) |
22 | ; | 25 | ; |
23 | } | 26 | } |
24 | 27 | ||
@@ -29,7 +32,7 @@ class EditEntryType extends AbstractType | |||
29 | )); | 32 | )); |
30 | } | 33 | } |
31 | 34 | ||
32 | public function getName() | 35 | public function getBlockPrefix() |
33 | { | 36 | { |
34 | return 'entry'; | 37 | return 'entry'; |
35 | } | 38 | } |
diff --git a/src/Wallabag/CoreBundle/Form/Type/NewEntryType.php b/src/Wallabag/CoreBundle/Form/Type/NewEntryType.php index cb96d11a..fbce13f1 100644 --- a/src/Wallabag/CoreBundle/Form/Type/NewEntryType.php +++ b/src/Wallabag/CoreBundle/Form/Type/NewEntryType.php | |||
@@ -3,6 +3,8 @@ | |||
3 | namespace Wallabag\CoreBundle\Form\Type; | 3 | namespace Wallabag\CoreBundle\Form\Type; |
4 | 4 | ||
5 | use Symfony\Component\Form\AbstractType; | 5 | use Symfony\Component\Form\AbstractType; |
6 | use Symfony\Component\Form\Extension\Core\Type\SubmitType; | ||
7 | use Symfony\Component\Form\Extension\Core\Type\UrlType; | ||
6 | use Symfony\Component\Form\FormBuilderInterface; | 8 | use Symfony\Component\Form\FormBuilderInterface; |
7 | use Symfony\Component\OptionsResolver\OptionsResolver; | 9 | use Symfony\Component\OptionsResolver\OptionsResolver; |
8 | 10 | ||
@@ -11,8 +13,8 @@ class NewEntryType extends AbstractType | |||
11 | public function buildForm(FormBuilderInterface $builder, array $options) | 13 | public function buildForm(FormBuilderInterface $builder, array $options) |
12 | { | 14 | { |
13 | $builder | 15 | $builder |
14 | ->add('url', 'url', array('required' => true)) | 16 | ->add('url', UrlType::class, array('required' => true)) |
15 | ->add('save', 'submit') | 17 | ->add('save', SubmitType::class) |
16 | ; | 18 | ; |
17 | } | 19 | } |
18 | 20 | ||
@@ -23,7 +25,7 @@ class NewEntryType extends AbstractType | |||
23 | )); | 25 | )); |
24 | } | 26 | } |
25 | 27 | ||
26 | public function getName() | 28 | public function getBlockPrefix() |
27 | { | 29 | { |
28 | return 'entry'; | 30 | return 'entry'; |
29 | } | 31 | } |
diff --git a/src/Wallabag/CoreBundle/Form/Type/NewTagType.php b/src/Wallabag/CoreBundle/Form/Type/NewTagType.php index 8e4ab649..0f559031 100644 --- a/src/Wallabag/CoreBundle/Form/Type/NewTagType.php +++ b/src/Wallabag/CoreBundle/Form/Type/NewTagType.php | |||
@@ -3,6 +3,8 @@ | |||
3 | namespace Wallabag\CoreBundle\Form\Type; | 3 | namespace Wallabag\CoreBundle\Form\Type; |
4 | 4 | ||
5 | use Symfony\Component\Form\AbstractType; | 5 | use Symfony\Component\Form\AbstractType; |
6 | use Symfony\Component\Form\Extension\Core\Type\SubmitType; | ||
7 | use Symfony\Component\Form\Extension\Core\Type\TextType; | ||
6 | use Symfony\Component\Form\FormBuilderInterface; | 8 | use Symfony\Component\Form\FormBuilderInterface; |
7 | use Symfony\Component\OptionsResolver\OptionsResolver; | 9 | use Symfony\Component\OptionsResolver\OptionsResolver; |
8 | 10 | ||
@@ -11,8 +13,8 @@ class NewTagType extends AbstractType | |||
11 | public function buildForm(FormBuilderInterface $builder, array $options) | 13 | public function buildForm(FormBuilderInterface $builder, array $options) |
12 | { | 14 | { |
13 | $builder | 15 | $builder |
14 | ->add('label', 'text', array('required' => true)) | 16 | ->add('label', TextType::class, array('required' => true)) |
15 | ->add('save', 'submit') | 17 | ->add('save', SubmitType::class) |
16 | ; | 18 | ; |
17 | } | 19 | } |
18 | 20 | ||
@@ -23,7 +25,7 @@ class NewTagType extends AbstractType | |||
23 | )); | 25 | )); |
24 | } | 26 | } |
25 | 27 | ||
26 | public function getName() | 28 | public function getBlockPrefix() |
27 | { | 29 | { |
28 | return 'tag'; | 30 | return 'tag'; |
29 | } | 31 | } |
diff --git a/src/Wallabag/CoreBundle/Form/Type/NewUserType.php b/src/Wallabag/CoreBundle/Form/Type/NewUserType.php index 8aabc8bb..ffbe9ba2 100644 --- a/src/Wallabag/CoreBundle/Form/Type/NewUserType.php +++ b/src/Wallabag/CoreBundle/Form/Type/NewUserType.php | |||
@@ -3,6 +3,11 @@ | |||
3 | namespace Wallabag\CoreBundle\Form\Type; | 3 | namespace Wallabag\CoreBundle\Form\Type; |
4 | 4 | ||
5 | use Symfony\Component\Form\AbstractType; | 5 | use Symfony\Component\Form\AbstractType; |
6 | use Symfony\Component\Form\Extension\Core\Type\EmailType; | ||
7 | use Symfony\Component\Form\Extension\Core\Type\PasswordType; | ||
8 | use Symfony\Component\Form\Extension\Core\Type\RepeatedType; | ||
9 | use Symfony\Component\Form\Extension\Core\Type\SubmitType; | ||
10 | use Symfony\Component\Form\Extension\Core\Type\TextType; | ||
6 | use Symfony\Component\Form\FormBuilderInterface; | 11 | use Symfony\Component\Form\FormBuilderInterface; |
7 | use Symfony\Component\OptionsResolver\OptionsResolver; | 12 | use Symfony\Component\OptionsResolver\OptionsResolver; |
8 | use Symfony\Component\Validator\Constraints; | 13 | use Symfony\Component\Validator\Constraints; |
@@ -12,9 +17,9 @@ class NewUserType extends AbstractType | |||
12 | public function buildForm(FormBuilderInterface $builder, array $options) | 17 | public function buildForm(FormBuilderInterface $builder, array $options) |
13 | { | 18 | { |
14 | $builder | 19 | $builder |
15 | ->add('username', 'text', array('required' => true)) | 20 | ->add('username', TextType::class, array('required' => true)) |
16 | ->add('plainPassword', 'repeated', array( | 21 | ->add('plainPassword', RepeatedType::class, array( |
17 | 'type' => 'password', | 22 | 'type' => PasswordType::class, |
18 | 'constraints' => array( | 23 | 'constraints' => array( |
19 | new Constraints\Length(array( | 24 | new Constraints\Length(array( |
20 | 'min' => 8, | 25 | 'min' => 8, |
@@ -23,8 +28,8 @@ class NewUserType extends AbstractType | |||
23 | new Constraints\NotBlank(), | 28 | new Constraints\NotBlank(), |
24 | ), | 29 | ), |
25 | )) | 30 | )) |
26 | ->add('email', 'email') | 31 | ->add('email', EmailType::class) |
27 | ->add('save', 'submit') | 32 | ->add('save', SubmitType::class) |
28 | ; | 33 | ; |
29 | } | 34 | } |
30 | 35 | ||
@@ -35,7 +40,7 @@ class NewUserType extends AbstractType | |||
35 | )); | 40 | )); |
36 | } | 41 | } |
37 | 42 | ||
38 | public function getName() | 43 | public function getBlockPrefix() |
39 | { | 44 | { |
40 | return 'new_user'; | 45 | return 'new_user'; |
41 | } | 46 | } |
diff --git a/src/Wallabag/CoreBundle/Form/Type/RssType.php b/src/Wallabag/CoreBundle/Form/Type/RssType.php index 1f7f4c68..def8782c 100644 --- a/src/Wallabag/CoreBundle/Form/Type/RssType.php +++ b/src/Wallabag/CoreBundle/Form/Type/RssType.php | |||
@@ -3,6 +3,7 @@ | |||
3 | namespace Wallabag\CoreBundle\Form\Type; | 3 | namespace Wallabag\CoreBundle\Form\Type; |
4 | 4 | ||
5 | use Symfony\Component\Form\AbstractType; | 5 | use Symfony\Component\Form\AbstractType; |
6 | use Symfony\Component\Form\Extension\Core\Type\SubmitType; | ||
6 | use Symfony\Component\Form\FormBuilderInterface; | 7 | use Symfony\Component\Form\FormBuilderInterface; |
7 | use Symfony\Component\OptionsResolver\OptionsResolver; | 8 | use Symfony\Component\OptionsResolver\OptionsResolver; |
8 | 9 | ||
@@ -12,7 +13,7 @@ class RssType extends AbstractType | |||
12 | { | 13 | { |
13 | $builder | 14 | $builder |
14 | ->add('rss_limit') | 15 | ->add('rss_limit') |
15 | ->add('save', 'submit') | 16 | ->add('save', SubmitType::class) |
16 | ; | 17 | ; |
17 | } | 18 | } |
18 | 19 | ||
@@ -23,7 +24,7 @@ class RssType extends AbstractType | |||
23 | )); | 24 | )); |
24 | } | 25 | } |
25 | 26 | ||
26 | public function getName() | 27 | public function getBlockPrefix() |
27 | { | 28 | { |
28 | return 'rss_config'; | 29 | return 'rss_config'; |
29 | } | 30 | } |
diff --git a/src/Wallabag/CoreBundle/Form/Type/TaggingRuleType.php b/src/Wallabag/CoreBundle/Form/Type/TaggingRuleType.php index 428d94b3..5815b8c6 100644 --- a/src/Wallabag/CoreBundle/Form/Type/TaggingRuleType.php +++ b/src/Wallabag/CoreBundle/Form/Type/TaggingRuleType.php | |||
@@ -3,6 +3,8 @@ | |||
3 | namespace Wallabag\CoreBundle\Form\Type; | 3 | namespace Wallabag\CoreBundle\Form\Type; |
4 | 4 | ||
5 | use Symfony\Component\Form\AbstractType; | 5 | use Symfony\Component\Form\AbstractType; |
6 | use Symfony\Component\Form\Extension\Core\Type\SubmitType; | ||
7 | use Symfony\Component\Form\Extension\Core\Type\TextType; | ||
6 | use Symfony\Component\Form\FormBuilderInterface; | 8 | use Symfony\Component\Form\FormBuilderInterface; |
7 | use Symfony\Component\OptionsResolver\OptionsResolver; | 9 | use Symfony\Component\OptionsResolver\OptionsResolver; |
8 | use Wallabag\CoreBundle\Form\DataTransformer\StringToListTransformer; | 10 | use Wallabag\CoreBundle\Form\DataTransformer\StringToListTransformer; |
@@ -12,12 +14,12 @@ class TaggingRuleType extends AbstractType | |||
12 | public function buildForm(FormBuilderInterface $builder, array $options) | 14 | public function buildForm(FormBuilderInterface $builder, array $options) |
13 | { | 15 | { |
14 | $builder | 16 | $builder |
15 | ->add('rule', 'text', array('required' => true)) | 17 | ->add('rule', TextType::class, array('required' => true)) |
16 | ->add('save', 'submit') | 18 | ->add('save', SubmitType::class) |
17 | ; | 19 | ; |
18 | 20 | ||
19 | $tagsField = $builder | 21 | $tagsField = $builder |
20 | ->create('tags', 'text') | 22 | ->create('tags', TextType::class) |
21 | ->addModelTransformer(new StringToListTransformer(',')); | 23 | ->addModelTransformer(new StringToListTransformer(',')); |
22 | 24 | ||
23 | $builder->add($tagsField); | 25 | $builder->add($tagsField); |
@@ -30,7 +32,7 @@ class TaggingRuleType extends AbstractType | |||
30 | )); | 32 | )); |
31 | } | 33 | } |
32 | 34 | ||
33 | public function getName() | 35 | public function getBlockPrefix() |
34 | { | 36 | { |
35 | return 'tagging_rule'; | 37 | return 'tagging_rule'; |
36 | } | 38 | } |
diff --git a/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php b/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php index e06c937d..f491b0ae 100644 --- a/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php +++ b/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php | |||
@@ -3,6 +3,10 @@ | |||
3 | namespace Wallabag\CoreBundle\Form\Type; | 3 | namespace Wallabag\CoreBundle\Form\Type; |
4 | 4 | ||
5 | use Symfony\Component\Form\AbstractType; | 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; | ||
6 | use Symfony\Component\Form\FormBuilderInterface; | 10 | use Symfony\Component\Form\FormBuilderInterface; |
7 | use Symfony\Component\OptionsResolver\OptionsResolver; | 11 | use Symfony\Component\OptionsResolver\OptionsResolver; |
8 | 12 | ||
@@ -11,10 +15,10 @@ class UserInformationType extends AbstractType | |||
11 | public function buildForm(FormBuilderInterface $builder, array $options) | 15 | public function buildForm(FormBuilderInterface $builder, array $options) |
12 | { | 16 | { |
13 | $builder | 17 | $builder |
14 | ->add('name', 'text') | 18 | ->add('name', TextType::class) |
15 | ->add('email', 'email') | 19 | ->add('email', EmailType::class) |
16 | ->add('twoFactorAuthentication', 'checkbox', array('required' => false)) | 20 | ->add('twoFactorAuthentication', CheckboxType::class, array('required' => false)) |
17 | ->add('save', 'submit') | 21 | ->add('save', SubmitType::class) |
18 | ->remove('username') | 22 | ->remove('username') |
19 | ->remove('plainPassword') | 23 | ->remove('plainPassword') |
20 | ; | 24 | ; |
@@ -22,7 +26,7 @@ class UserInformationType extends AbstractType | |||
22 | 26 | ||
23 | public function getParent() | 27 | public function getParent() |
24 | { | 28 | { |
25 | return 'fos_user_registration'; | 29 | return 'FOS\UserBundle\Form\Type\RegistrationFormType'; |
26 | } | 30 | } |
27 | 31 | ||
28 | public function configureOptions(OptionsResolver $resolver) | 32 | public function configureOptions(OptionsResolver $resolver) |
@@ -32,7 +36,7 @@ class UserInformationType extends AbstractType | |||
32 | )); | 36 | )); |
33 | } | 37 | } |
34 | 38 | ||
35 | public function getName() | 39 | public function getBlockPrefix() |
36 | { | 40 | { |
37 | return 'update_user'; | 41 | return 'update_user'; |
38 | } | 42 | } |