1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-13 18:24:57 +02:00

Fix issue in the new ProcessPageList "hidden" pages option where it wasn't always working as intended.

This commit is contained in:
Ryan Cramer
2022-06-24 13:31:32 -04:00
parent 818b78a42c
commit f4b938146d

View File

@@ -156,6 +156,18 @@ class ProcessPageListRenderJSON extends ProcessPageListRender {
$config = $this->wire()->config;
$idTrash = $config->trashPageID;
$id404 = $config->http404PageID;
$states = array();
$showHidden = true;
if(!empty($this->hidePages)) {
$showHidden = false;
foreach($this->hidePagesNot as $state) {
if($state === 'debug' && $config->debug) $states[$state] = $state;
if($state === 'advanced' && $config->advanced) $states[$state] = $state;
if($state === 'superuser' && $this->superuser) $states[$state] = $state;
}
if($states == $this->hidePagesNot) $showHidden = true;
}
foreach($this->children as $page) {
@@ -167,14 +179,9 @@ class ProcessPageListRenderJSON extends ProcessPageListRender {
// allow showing 404 page, only if it's editable
if(!$page->editable()) continue;
} else if(isset($this->hidePages[$id]) && $id != $idTrash && $id != 1) {
$states = array();
foreach($this->hidePagesNot as $state) {
if($state === 'debug' && $config->debug) $states[] = $state;
if($state === 'advanced' && $config->advanced) $states[] = $state;
if($state === 'superuser' && $this->superuser) $states[] = $state;
}
if(count($states) === count($this->hidePagesNot)) continue;
} else if(isset($this->hidePages[$id]) && $id !== $idTrash && $id !== 1) {
// page hidden in page tree
if(!$showHidden) continue;
} else if(isset($this->systemIDs[$id])) {
if($this->superuser) $extraPages[$id] = $page;