aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2017-06-12 10:26:01 +0200
committerGitHub <noreply@github.com>2017-06-12 10:26:01 +0200
commit977ac0a1d6c5e42d0bb2cbb13eac6213fefbb175 (patch)
tree820044e9630a1e0db88d9838370b6e50e6e0b376 /src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php
parent873f6b8e03079d11fab541aa5b0bc6f8fe2d645e (diff)
parentd9da186fb8427ca82d1fd7c4e2ef3f5032781f23 (diff)
downloadwallabag-977ac0a1d6c5e42d0bb2cbb13eac6213fefbb175.tar.gz
wallabag-977ac0a1d6c5e42d0bb2cbb13eac6213fefbb175.tar.zst
wallabag-977ac0a1d6c5e42d0bb2cbb13eac6213fefbb175.zip
Merge pull request #3208 from wallabag/is-public
Add ability to filter public entries & use it in the API
Diffstat (limited to 'src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php')
-rw-r--r--src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php
index 556578d1..6a4c485f 100644
--- a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php
+++ b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php
@@ -150,6 +150,20 @@ class EntryFilterType extends AbstractType
150 }, 150 },
151 'label' => 'entry.filters.preview_picture_label', 151 'label' => 'entry.filters.preview_picture_label',
152 ]) 152 ])
153 ->add('isPublic', CheckboxFilterType::class, [
154 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) {
155 if (false === $values['value']) {
156 return;
157 }
158
159 // is_public isn't a real field
160 // we should use the "uid" field to determine if the entry has been made public
161 $expression = $filterQuery->getExpr()->isNotNull($values['alias'].'.uid');
162
163 return $filterQuery->createCondition($expression);
164 },
165 'label' => 'entry.filters.is_public_label',
166 ])
153 ->add('language', ChoiceFilterType::class, [ 167 ->add('language', ChoiceFilterType::class, [
154 'choices' => array_flip($this->repository->findDistinctLanguageByUser($this->user->getId())), 168 'choices' => array_flip($this->repository->findDistinctLanguageByUser($this->user->getId())),
155 'label' => 'entry.filters.language_label', 169 'label' => 'entry.filters.language_label',