From 733b2cf19b5d5a93617f24b2447b9a30ba22d303 Mon Sep 17 00:00:00 2001 From: Daniel Bartram Date: Mon, 9 May 2016 14:19:09 +0100 Subject: Add unread filter to entries pages Add the ability to filter for unread pages in the filters menu. --- src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php') diff --git a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php index cd4d3490..f3f848e9 100644 --- a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php +++ b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php @@ -87,6 +87,18 @@ class EntryFilterType extends AbstractType ->add('isStarred', CheckboxFilterType::class, [ 'label' => 'entry.filters.starred_label', ]) + ->add('isUnread', CheckboxFilterType::class, [ + 'label' => 'entry.filters.unread_label', + 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { + if (false === $values['value']) { + return; + } + + $expression = $filterQuery->getExpr()->eq('e.isArchived', 'false'); + + return $filterQuery->createCondition($expression); + }, + ]) ->add('previewPicture', CheckboxFilterType::class, [ 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { if (false === $values['value']) { -- cgit v1.2.3