diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Form/Type')
4 files changed, 63 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php index 0bac2874..7e3b9dd4 100644 --- a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php +++ b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php | |||
@@ -7,6 +7,7 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType; | |||
7 | use Symfony\Component\Form\Extension\Core\Type\SubmitType; | 7 | use Symfony\Component\Form\Extension\Core\Type\SubmitType; |
8 | use Symfony\Component\Form\FormBuilderInterface; | 8 | use Symfony\Component\Form\FormBuilderInterface; |
9 | use Symfony\Component\OptionsResolver\OptionsResolver; | 9 | use Symfony\Component\OptionsResolver\OptionsResolver; |
10 | use Wallabag\CoreBundle\Entity\Config; | ||
10 | 11 | ||
11 | class ConfigType extends AbstractType | 12 | class ConfigType extends AbstractType |
12 | { | 13 | { |
@@ -48,6 +49,13 @@ class ConfigType extends AbstractType | |||
48 | 'config.form_settings.reading_speed.400_word' => '2', | 49 | 'config.form_settings.reading_speed.400_word' => '2', |
49 | ], | 50 | ], |
50 | ]) | 51 | ]) |
52 | ->add('action_mark_as_read', ChoiceType::class, [ | ||
53 | 'label' => 'config.form_settings.action_mark_as_read.label', | ||
54 | 'choices' => [ | ||
55 | 'config.form_settings.action_mark_as_read.redirect_homepage' => Config::REDIRECT_TO_HOMEPAGE, | ||
56 | 'config.form_settings.action_mark_as_read.redirect_current_page' => Config::REDIRECT_TO_CURRENT_PAGE, | ||
57 | ], | ||
58 | ]) | ||
51 | ->add('language', ChoiceType::class, [ | 59 | ->add('language', ChoiceType::class, [ |
52 | 'choices' => array_flip($this->languages), | 60 | 'choices' => array_flip($this->languages), |
53 | 'label' => 'config.form_settings.language_label', | 61 | 'label' => 'config.form_settings.language_label', |
diff --git a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php index a3e36fdd..7b02f85c 100644 --- a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php +++ b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php | |||
@@ -11,6 +11,7 @@ use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\CheckboxFilterType; | |||
11 | use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\ChoiceFilterType; | 11 | use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\ChoiceFilterType; |
12 | use Symfony\Component\Form\AbstractType; | 12 | use Symfony\Component\Form\AbstractType; |
13 | use Symfony\Component\Form\FormBuilderInterface; | 13 | use Symfony\Component\Form\FormBuilderInterface; |
14 | use Symfony\Component\HttpFoundation\Response; | ||
14 | use Symfony\Component\OptionsResolver\OptionsResolver; | 15 | use Symfony\Component\OptionsResolver\OptionsResolver; |
15 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; | 16 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; |
16 | 17 | ||
@@ -95,6 +96,21 @@ class EntryFilterType extends AbstractType | |||
95 | }, | 96 | }, |
96 | 'label' => 'entry.filters.domain_label', | 97 | 'label' => 'entry.filters.domain_label', |
97 | ]) | 98 | ]) |
99 | ->add('httpStatus', TextFilterType::class, [ | ||
100 | 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { | ||
101 | $value = $values['value']; | ||
102 | if (false === array_key_exists($value, Response::$statusTexts)) { | ||
103 | return; | ||
104 | } | ||
105 | |||
106 | $paramName = sprintf('%s', str_replace('.', '_', $field)); | ||
107 | $expression = $filterQuery->getExpr()->eq($field, ':'.$paramName); | ||
108 | $parameters = array($paramName => $value); | ||
109 | |||
110 | return $filterQuery->createCondition($expression, $parameters); | ||
111 | }, | ||
112 | 'label' => 'entry.filters.http_status_label', | ||
113 | ]) | ||
98 | ->add('isArchived', CheckboxFilterType::class, [ | 114 | ->add('isArchived', CheckboxFilterType::class, [ |
99 | 'label' => 'entry.filters.archived_label', | 115 | 'label' => 'entry.filters.archived_label', |
100 | ]) | 116 | ]) |
diff --git a/src/Wallabag/CoreBundle/Form/Type/NewTagType.php b/src/Wallabag/CoreBundle/Form/Type/NewTagType.php index 3db4105f..e830ade4 100644 --- a/src/Wallabag/CoreBundle/Form/Type/NewTagType.php +++ b/src/Wallabag/CoreBundle/Form/Type/NewTagType.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\Extension\Core\Type\TextType; | 7 | use Symfony\Component\Form\Extension\Core\Type\TextType; |
7 | use Symfony\Component\Form\FormBuilderInterface; | 8 | use Symfony\Component\Form\FormBuilderInterface; |
8 | use Symfony\Component\OptionsResolver\OptionsResolver; | 9 | use Symfony\Component\OptionsResolver\OptionsResolver; |
@@ -12,7 +13,15 @@ class NewTagType extends AbstractType | |||
12 | public function buildForm(FormBuilderInterface $builder, array $options) | 13 | public function buildForm(FormBuilderInterface $builder, array $options) |
13 | { | 14 | { |
14 | $builder | 15 | $builder |
15 | ->add('label', TextType::class, ['required' => true]) | 16 | ->add('label', TextType::class, [ |
17 | 'required' => true, | ||
18 | 'attr' => [ | ||
19 | 'placeholder' => 'tag.new.placeholder', | ||
20 | ], | ||
21 | ]) | ||
22 | ->add('add', SubmitType::class, [ | ||
23 | 'label' => 'tag.new.add', | ||
24 | ]) | ||
16 | ; | 25 | ; |
17 | } | 26 | } |
18 | 27 | ||
diff --git a/src/Wallabag/CoreBundle/Form/Type/SearchEntryType.php b/src/Wallabag/CoreBundle/Form/Type/SearchEntryType.php new file mode 100644 index 00000000..b56cae8e --- /dev/null +++ b/src/Wallabag/CoreBundle/Form/Type/SearchEntryType.php | |||
@@ -0,0 +1,29 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Form\Type; | ||
4 | |||
5 | use Symfony\Component\Form\AbstractType; | ||
6 | use Symfony\Component\Form\Extension\Core\Type\TextType; | ||
7 | use Symfony\Component\Form\FormBuilderInterface; | ||
8 | use Symfony\Component\OptionsResolver\OptionsResolver; | ||
9 | |||
10 | class SearchEntryType extends AbstractType | ||
11 | { | ||
12 | public function buildForm(FormBuilderInterface $builder, array $options) | ||
13 | { | ||
14 | $builder | ||
15 | ->setMethod('GET') | ||
16 | ->add('term', TextType::class, [ | ||
17 | 'required' => true, | ||
18 | 'label' => 'entry.new.form_search.term_label', | ||
19 | ]) | ||
20 | ; | ||
21 | } | ||
22 | |||
23 | public function configureOptions(OptionsResolver $resolver) | ||
24 | { | ||
25 | $resolver->setDefaults([ | ||
26 | 'csrf_protection' => false, | ||
27 | ]); | ||
28 | } | ||
29 | } | ||