diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Form/Type')
10 files changed, 96 insertions, 35 deletions
diff --git a/src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php b/src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php index 7d05a5d8..841af51e 100644 --- a/src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php +++ b/src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php | |||
@@ -16,23 +16,27 @@ class ChangePasswordType extends AbstractType | |||
16 | { | 16 | { |
17 | $builder | 17 | $builder |
18 | ->add('old_password', PasswordType::class, array( | 18 | ->add('old_password', PasswordType::class, array( |
19 | 'constraints' => new UserPassword(array('message' => 'Wrong value for your current password')), | 19 | 'constraints' => new UserPassword(array('message' => 'validator.password_wrong_value')), |
20 | 'label' => 'config.form_password.old_password_label', | ||
20 | )) | 21 | )) |
21 | ->add('new_password', RepeatedType::class, array( | 22 | ->add('new_password', RepeatedType::class, array( |
22 | 'type' => PasswordType::class, | 23 | 'type' => PasswordType::class, |
23 | 'invalid_message' => 'The password fields must match.', | 24 | 'invalid_message' => 'validator.password_must_match', |
24 | 'required' => true, | 25 | 'required' => true, |
25 | 'first_options' => array('label' => 'New password'), | 26 | 'first_options' => array('label' => 'config.form_password.new_password_label'), |
26 | 'second_options' => array('label' => 'Repeat new password'), | 27 | 'second_options' => array('label' => 'config.form_password.repeat_new_password_label'), |
27 | 'constraints' => array( | 28 | 'constraints' => array( |
28 | new Constraints\Length(array( | 29 | new Constraints\Length(array( |
29 | 'min' => 8, | 30 | 'min' => 8, |
30 | 'minMessage' => 'Password should by at least 8 chars long', | 31 | 'minMessage' => 'validator.password_too_short', |
31 | )), | 32 | )), |
32 | new Constraints\NotBlank(), | 33 | new Constraints\NotBlank(), |
33 | ), | 34 | ), |
35 | 'label' => 'config.form_password.new_password_label', | ||
36 | )) | ||
37 | ->add('save', SubmitType::class, array( | ||
38 | 'label' => 'config.form.save', | ||
34 | )) | 39 | )) |
35 | ->add('save', SubmitType::class) | ||
36 | ; | 40 | ; |
37 | } | 41 | } |
38 | 42 | ||
diff --git a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php index 0a5ea6cc..25ea9efa 100644 --- a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php +++ b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php | |||
@@ -33,9 +33,13 @@ class ConfigType extends AbstractType | |||
33 | ->add('theme', ChoiceType::class, array( | 33 | ->add('theme', ChoiceType::class, array( |
34 | 'choices' => array_flip($this->themes), | 34 | 'choices' => array_flip($this->themes), |
35 | 'choices_as_values' => true, | 35 | 'choices_as_values' => true, |
36 | 'label' => 'config.form_settings.theme_label', | ||
37 | )) | ||
38 | ->add('items_per_page', null, array( | ||
39 | 'label' => 'config.form_settings.items_per_page_label', | ||
36 | )) | 40 | )) |
37 | ->add('items_per_page') | ||
38 | ->add('reading_speed', ChoiceType::class, array( | 41 | ->add('reading_speed', ChoiceType::class, array( |
42 | 'label' => 'config.form_settings.reading_speed', | ||
39 | 'choices' => array( | 43 | 'choices' => array( |
40 | 'I read ~100 words per minute' => '0.5', | 44 | 'I read ~100 words per minute' => '0.5', |
41 | 'I read ~200 words per minute' => '1', | 45 | 'I read ~200 words per minute' => '1', |
@@ -46,8 +50,11 @@ class ConfigType extends AbstractType | |||
46 | ->add('language', ChoiceType::class, array( | 50 | ->add('language', ChoiceType::class, array( |
47 | 'choices' => array_flip($this->languages), | 51 | 'choices' => array_flip($this->languages), |
48 | 'choices_as_values' => true, | 52 | 'choices_as_values' => true, |
53 | 'label' => 'config.form_settings.language_label', | ||
54 | )) | ||
55 | ->add('save', SubmitType::class, array( | ||
56 | 'label' => 'config.form.save', | ||
49 | )) | 57 | )) |
50 | ->add('save', SubmitType::class) | ||
51 | ; | 58 | ; |
52 | } | 59 | } |
53 | 60 | ||
diff --git a/src/Wallabag/CoreBundle/Form/Type/EditEntryType.php b/src/Wallabag/CoreBundle/Form/Type/EditEntryType.php index 2b1e1ef4..23d7b239 100644 --- a/src/Wallabag/CoreBundle/Form/Type/EditEntryType.php +++ b/src/Wallabag/CoreBundle/Form/Type/EditEntryType.php | |||
@@ -14,9 +14,22 @@ class EditEntryType extends AbstractType | |||
14 | public function buildForm(FormBuilderInterface $builder, array $options) | 14 | public function buildForm(FormBuilderInterface $builder, array $options) |
15 | { | 15 | { |
16 | $builder | 16 | $builder |
17 | ->add('title', TextType::class, array('required' => true)) | 17 | ->add('title', TextType::class, array( |
18 | ->add('is_public', CheckboxType::class, array('required' => false)) | 18 | 'required' => true, |
19 | ->add('save', SubmitType::class) | 19 | 'label' => 'entry.edit.title_label', |
20 | )) | ||
21 | ->add('is_public', CheckboxType::class, array( | ||
22 | 'required' => false, | ||
23 | 'label' => 'entry.edit.is_public_label', | ||
24 | )) | ||
25 | ->add('url', TextType::class, array( | ||
26 | 'disabled' => true, | ||
27 | 'required' => false, | ||
28 | 'label' => 'entry.edit.url_label', | ||
29 | )) | ||
30 | ->add('save', SubmitType::class, array( | ||
31 | 'label' => 'entry.edit.save_label', | ||
32 | )) | ||
20 | ; | 33 | ; |
21 | } | 34 | } |
22 | 35 | ||
diff --git a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php index ee10bc8b..ec36503b 100644 --- a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php +++ b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php | |||
@@ -34,7 +34,9 @@ class EntryFilterType extends AbstractType | |||
34 | public function buildForm(FormBuilderInterface $builder, array $options) | 34 | public function buildForm(FormBuilderInterface $builder, array $options) |
35 | { | 35 | { |
36 | $builder | 36 | $builder |
37 | ->add('readingTime', NumberRangeFilterType::class) | 37 | ->add('readingTime', NumberRangeFilterType::class, array( |
38 | 'label' => 'entry.filters.reading_time.label', | ||
39 | )) | ||
38 | ->add('createdAt', DateRangeFilterType::class, array( | 40 | ->add('createdAt', DateRangeFilterType::class, array( |
39 | 'left_date_options' => array( | 41 | 'left_date_options' => array( |
40 | 'attr' => array( | 42 | 'attr' => array( |
@@ -50,6 +52,7 @@ class EntryFilterType extends AbstractType | |||
50 | 'format' => 'dd/MM/yyyy', | 52 | 'format' => 'dd/MM/yyyy', |
51 | 'widget' => 'single_text', | 53 | 'widget' => 'single_text', |
52 | ), | 54 | ), |
55 | 'label' => 'entry.filters.created_at.label', | ||
53 | ) | 56 | ) |
54 | ) | 57 | ) |
55 | ->add('domainName', TextFilterType::class, array( | 58 | ->add('domainName', TextFilterType::class, array( |
@@ -62,9 +65,14 @@ class EntryFilterType extends AbstractType | |||
62 | 65 | ||
63 | return $filterQuery->createCondition($expression); | 66 | return $filterQuery->createCondition($expression); |
64 | }, | 67 | }, |
68 | 'label' => 'entry.filters.domain_label', | ||
69 | )) | ||
70 | ->add('isArchived', CheckboxFilterType::class, array( | ||
71 | 'label' => 'entry.filters.archived_label', | ||
72 | )) | ||
73 | ->add('isStarred', CheckboxFilterType::class, array( | ||
74 | 'label' => 'entry.filters.starred_label', | ||
65 | )) | 75 | )) |
66 | ->add('isArchived', CheckboxFilterType::class) | ||
67 | ->add('isStarred', CheckboxFilterType::class) | ||
68 | ->add('previewPicture', CheckboxFilterType::class, array( | 76 | ->add('previewPicture', CheckboxFilterType::class, array( |
69 | 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { | 77 | 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { |
70 | if (false === $values['value']) { | 78 | if (false === $values['value']) { |
@@ -75,10 +83,12 @@ class EntryFilterType extends AbstractType | |||
75 | 83 | ||
76 | return $filterQuery->createCondition($expression); | 84 | return $filterQuery->createCondition($expression); |
77 | }, | 85 | }, |
86 | 'label' => 'entry.filters.preview_picture_label', | ||
78 | )) | 87 | )) |
79 | ->add('language', ChoiceFilterType::class, array( | 88 | ->add('language', ChoiceFilterType::class, array( |
80 | 'choices' => array_flip($this->repository->findDistinctLanguageByUser($this->user->getId())), | 89 | 'choices' => array_flip($this->repository->findDistinctLanguageByUser($this->user->getId())), |
81 | 'choices_as_values' => true, | 90 | 'choices_as_values' => true, |
91 | 'label' => 'entry.filters.language_label', | ||
82 | )) | 92 | )) |
83 | ; | 93 | ; |
84 | } | 94 | } |
diff --git a/src/Wallabag/CoreBundle/Form/Type/NewEntryType.php b/src/Wallabag/CoreBundle/Form/Type/NewEntryType.php index fbce13f1..69fab6fb 100644 --- a/src/Wallabag/CoreBundle/Form/Type/NewEntryType.php +++ b/src/Wallabag/CoreBundle/Form/Type/NewEntryType.php | |||
@@ -3,7 +3,6 @@ | |||
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\Extension\Core\Type\UrlType; |
8 | use Symfony\Component\Form\FormBuilderInterface; | 7 | use Symfony\Component\Form\FormBuilderInterface; |
9 | use Symfony\Component\OptionsResolver\OptionsResolver; | 8 | use Symfony\Component\OptionsResolver\OptionsResolver; |
@@ -13,8 +12,10 @@ class NewEntryType extends AbstractType | |||
13 | public function buildForm(FormBuilderInterface $builder, array $options) | 12 | public function buildForm(FormBuilderInterface $builder, array $options) |
14 | { | 13 | { |
15 | $builder | 14 | $builder |
16 | ->add('url', UrlType::class, array('required' => true)) | 15 | ->add('url', UrlType::class, array( |
17 | ->add('save', SubmitType::class) | 16 | 'required' => true, |
17 | 'label' => 'entry.new.form_new.url_label', | ||
18 | )) | ||
18 | ; | 19 | ; |
19 | } | 20 | } |
20 | 21 | ||
diff --git a/src/Wallabag/CoreBundle/Form/Type/NewTagType.php b/src/Wallabag/CoreBundle/Form/Type/NewTagType.php index 0f559031..c7568de7 100644 --- a/src/Wallabag/CoreBundle/Form/Type/NewTagType.php +++ b/src/Wallabag/CoreBundle/Form/Type/NewTagType.php | |||
@@ -3,7 +3,6 @@ | |||
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\Extension\Core\Type\TextType; |
8 | use Symfony\Component\Form\FormBuilderInterface; | 7 | use Symfony\Component\Form\FormBuilderInterface; |
9 | use Symfony\Component\OptionsResolver\OptionsResolver; | 8 | use Symfony\Component\OptionsResolver\OptionsResolver; |
@@ -14,7 +13,6 @@ class NewTagType extends AbstractType | |||
14 | { | 13 | { |
15 | $builder | 14 | $builder |
16 | ->add('label', TextType::class, array('required' => true)) | 15 | ->add('label', TextType::class, array('required' => true)) |
17 | ->add('save', SubmitType::class) | ||
18 | ; | 16 | ; |
19 | } | 17 | } |
20 | 18 | ||
diff --git a/src/Wallabag/CoreBundle/Form/Type/NewUserType.php b/src/Wallabag/CoreBundle/Form/Type/NewUserType.php index 6eb0e63f..60fcc20c 100644 --- a/src/Wallabag/CoreBundle/Form/Type/NewUserType.php +++ b/src/Wallabag/CoreBundle/Form/Type/NewUserType.php | |||
@@ -17,22 +17,30 @@ class NewUserType extends AbstractType | |||
17 | public function buildForm(FormBuilderInterface $builder, array $options) | 17 | public function buildForm(FormBuilderInterface $builder, array $options) |
18 | { | 18 | { |
19 | $builder | 19 | $builder |
20 | ->add('username', TextType::class, array('required' => true)) | 20 | ->add('username', TextType::class, array( |
21 | 'required' => true, | ||
22 | 'label' => 'config.form_new_user.username_label', | ||
23 | )) | ||
21 | ->add('plainPassword', RepeatedType::class, array( | 24 | ->add('plainPassword', RepeatedType::class, array( |
22 | 'type' => PasswordType::class, | 25 | 'type' => PasswordType::class, |
23 | 'invalid_message' => 'The password fields must match', | 26 | 'invalid_message' => 'validator.password_must_match', |
24 | 'first_options' => array('label' => 'Password'), | 27 | 'first_options' => array('label' => 'config.form_new_user.password_label'), |
25 | 'second_options' => array('label' => 'Repeat new password'), | 28 | 'second_options' => array('label' => 'config.form_new_user.repeat_new_password_label'), |
26 | 'constraints' => array( | 29 | 'constraints' => array( |
27 | new Constraints\Length(array( | 30 | new Constraints\Length(array( |
28 | 'min' => 8, | 31 | 'min' => 8, |
29 | 'minMessage' => 'Password should by at least 8 chars long', | 32 | 'minMessage' => 'validator.password_too_short', |
30 | )), | 33 | )), |
31 | new Constraints\NotBlank(), | 34 | new Constraints\NotBlank(), |
32 | ), | 35 | ), |
36 | 'label' => 'config.form_new_user.plain_password_label', | ||
37 | )) | ||
38 | ->add('email', EmailType::class, array( | ||
39 | 'label' => 'config.form_new_user.email_label', | ||
40 | )) | ||
41 | ->add('save', SubmitType::class, array( | ||
42 | 'label' => 'config.form.save', | ||
33 | )) | 43 | )) |
34 | ->add('email', EmailType::class) | ||
35 | ->add('save', SubmitType::class) | ||
36 | ; | 44 | ; |
37 | } | 45 | } |
38 | 46 | ||
diff --git a/src/Wallabag/CoreBundle/Form/Type/RssType.php b/src/Wallabag/CoreBundle/Form/Type/RssType.php index def8782c..a9f68e54 100644 --- a/src/Wallabag/CoreBundle/Form/Type/RssType.php +++ b/src/Wallabag/CoreBundle/Form/Type/RssType.php | |||
@@ -12,8 +12,12 @@ class RssType extends AbstractType | |||
12 | public function buildForm(FormBuilderInterface $builder, array $options) | 12 | public function buildForm(FormBuilderInterface $builder, array $options) |
13 | { | 13 | { |
14 | $builder | 14 | $builder |
15 | ->add('rss_limit') | 15 | ->add('rss_limit', null, array( |
16 | ->add('save', SubmitType::class) | 16 | 'label' => 'config.form_rss.rss_limit', |
17 | )) | ||
18 | ->add('save', SubmitType::class, array( | ||
19 | 'label' => 'config.form.save', | ||
20 | )) | ||
17 | ; | 21 | ; |
18 | } | 22 | } |
19 | 23 | ||
diff --git a/src/Wallabag/CoreBundle/Form/Type/TaggingRuleType.php b/src/Wallabag/CoreBundle/Form/Type/TaggingRuleType.php index 5815b8c6..cfee21f1 100644 --- a/src/Wallabag/CoreBundle/Form/Type/TaggingRuleType.php +++ b/src/Wallabag/CoreBundle/Form/Type/TaggingRuleType.php | |||
@@ -14,12 +14,19 @@ class TaggingRuleType extends AbstractType | |||
14 | public function buildForm(FormBuilderInterface $builder, array $options) | 14 | public function buildForm(FormBuilderInterface $builder, array $options) |
15 | { | 15 | { |
16 | $builder | 16 | $builder |
17 | ->add('rule', TextType::class, array('required' => true)) | 17 | ->add('rule', TextType::class, array( |
18 | ->add('save', SubmitType::class) | 18 | 'required' => true, |
19 | 'label' => 'config.form_rules.rule_label', | ||
20 | )) | ||
21 | ->add('save', SubmitType::class, array( | ||
22 | 'label' => 'config.form.save', | ||
23 | )) | ||
19 | ; | 24 | ; |
20 | 25 | ||
21 | $tagsField = $builder | 26 | $tagsField = $builder |
22 | ->create('tags', TextType::class) | 27 | ->create('tags', TextType::class, array( |
28 | 'label' => 'config.form_rules.tags_label', | ||
29 | )) | ||
23 | ->addModelTransformer(new StringToListTransformer(',')); | 30 | ->addModelTransformer(new StringToListTransformer(',')); |
24 | 31 | ||
25 | $builder->add($tagsField); | 32 | $builder->add($tagsField); |
diff --git a/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php b/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php index f491b0ae..799ea39e 100644 --- a/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php +++ b/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php | |||
@@ -15,10 +15,19 @@ class UserInformationType extends AbstractType | |||
15 | public function buildForm(FormBuilderInterface $builder, array $options) | 15 | public function buildForm(FormBuilderInterface $builder, array $options) |
16 | { | 16 | { |
17 | $builder | 17 | $builder |
18 | ->add('name', TextType::class) | 18 | ->add('name', TextType::class, array( |
19 | ->add('email', EmailType::class) | 19 | 'label' => 'config.form_user.name_label', |
20 | ->add('twoFactorAuthentication', CheckboxType::class, array('required' => false)) | 20 | )) |
21 | ->add('save', SubmitType::class) | 21 | ->add('email', EmailType::class, array( |
22 | 'label' => 'config.form_user.email_label', | ||
23 | )) | ||
24 | ->add('twoFactorAuthentication', CheckboxType::class, array( | ||
25 | 'required' => false, | ||
26 | 'label' => 'config.form_user.twoFactorAuthentication_label', | ||
27 | )) | ||
28 | ->add('save', SubmitType::class, array( | ||
29 | 'label' => 'config.form.save', | ||
30 | )) | ||
22 | ->remove('username') | 31 | ->remove('username') |
23 | ->remove('plainPassword') | 32 | ->remove('plainPassword') |
24 | ; | 33 | ; |