Preselect currently active section in the filter menu

Fixes #2533

Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
This commit is contained in:
Kevin Decherf
2021-01-23 21:34:45 +01:00
parent 07e249ee57
commit 8e89b3ad76
3 changed files with 41 additions and 5 deletions

View File

@ -118,12 +118,15 @@ class EntryFilterType extends AbstractType
])
->add('isArchived', CheckboxFilterType::class, [
'label' => 'entry.filters.archived_label',
'data' => $options['filter_archived'],
])
->add('isStarred', CheckboxFilterType::class, [
'label' => 'entry.filters.starred_label',
'data' => $options['filter_starred'],
])
->add('isUnread', CheckboxFilterType::class, [
'label' => 'entry.filters.unread_label',
'data' => $options['filter_unread'],
'apply_filter' => function (QueryInterface $filterQuery, $field, $values) {
if (false === $values['value']) {
return;
@ -177,6 +180,9 @@ class EntryFilterType extends AbstractType
$resolver->setDefaults([
'csrf_protection' => false,
'validation_groups' => ['filtering'],
'filter_archived' => false,
'filter_starred' => false,
'filter_unread' => false,
]);
}
}