From 45cea4fc4bfa1cbd2d88612ccd5cecb7c16982dc Mon Sep 17 00:00:00 2001 From: Czcibor Bohusz-Dobosz Date: Wed, 10 Feb 2021 03:58:38 +0100 Subject: [PATCH] Fixed removing inclusive filters in getCollection --- system/src/Grav/Common/Page/Pages.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/system/src/Grav/Common/Page/Pages.php b/system/src/Grav/Common/Page/Pages.php index dadaf7144..c4e6cf724 100644 --- a/system/src/Grav/Common/Page/Pages.php +++ b/system/src/Grav/Common/Page/Pages.php @@ -449,7 +449,6 @@ class Pages } } - // Remove any inclusive sets from filter. $filters = $params['filter'] ?? []; // Assume published=true if not set. @@ -457,6 +456,15 @@ class Pages $filters['published'] = true; } + // Remove any inclusive sets from filter. + $sets = ['published', 'visible', 'modular', 'routable']; + foreach ($sets as $type) { + $var = "non-{$type}"; + if (isset($filters[$type], $filters[$var]) && $filters[$type] && $filters[$var]) { + unset($filters[$type], $filters[$var]); + } + } + // Filter the collection foreach ($filters as $type => $filter) { // Convert non-type to type.