mirror of
https://github.com/getgrav/grav.git
synced 2026-06-18 03:21:47 +02:00
Fixed behavior of opposite filters in Pages::getCollection() to match Grav 1.6 [#3216]
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
* Fixed pipelined asset using different hash when extra asset is added to before/after position [#2781](https://github.com/getgrav/grav/issues/2781)
|
||||
* Fixed trailing slash redirect to only apply to GET/HEAD requests and use 301 status code [#3127](https://github.com/getgrav/grav/issues/3127)
|
||||
* Fixed `<meta name="flattr:*" content="*">` to use name instead property [#3010](https://github.com/getgrav/grav/pull/3010)
|
||||
* Fixed behavior of opposite filters in `Pages::getCollection()` to match Grav 1.6 [#3216](https://github.com/getgrav/grav/pull/3216)
|
||||
|
||||
# v1.7.5
|
||||
## 02/01/2021
|
||||
|
||||
@@ -459,14 +459,24 @@ class Pages
|
||||
// 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]);
|
||||
$nonType = "non-{$type}";
|
||||
if (isset($filters[$type], $filters[$nonType]) && $filters[$type] === $filters[$nonType]) {
|
||||
if (!$filters[$type]) {
|
||||
// Both options are false, return empty collection as nothing can match the filters.
|
||||
return new Collection();
|
||||
}
|
||||
|
||||
// Both options are true, remove opposite filters as all pages will match the filters.
|
||||
unset($filters[$type], $filters[$nonType]);
|
||||
}
|
||||
}
|
||||
|
||||
// Filter the collection
|
||||
foreach ($filters as $type => $filter) {
|
||||
if (null === $filter) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Convert non-type to type.
|
||||
if (str_starts_with($type, 'non-')) {
|
||||
$type = substr($type, 4);
|
||||
|
||||
Reference in New Issue
Block a user