mirror of
https://github.com/processwire/processwire.git
synced 2025-08-15 11:14:12 +02:00
Fix issue in the new ProcessPageList "hidden" pages option where it wasn't always working as intended.
This commit is contained in:
@@ -156,6 +156,18 @@ class ProcessPageListRenderJSON extends ProcessPageListRender {
|
|||||||
$config = $this->wire()->config;
|
$config = $this->wire()->config;
|
||||||
$idTrash = $config->trashPageID;
|
$idTrash = $config->trashPageID;
|
||||||
$id404 = $config->http404PageID;
|
$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) {
|
foreach($this->children as $page) {
|
||||||
|
|
||||||
@@ -167,14 +179,9 @@ class ProcessPageListRenderJSON extends ProcessPageListRender {
|
|||||||
// allow showing 404 page, only if it's editable
|
// allow showing 404 page, only if it's editable
|
||||||
if(!$page->editable()) continue;
|
if(!$page->editable()) continue;
|
||||||
|
|
||||||
} else if(isset($this->hidePages[$id]) && $id != $idTrash && $id != 1) {
|
} else if(isset($this->hidePages[$id]) && $id !== $idTrash && $id !== 1) {
|
||||||
$states = array();
|
// page hidden in page tree
|
||||||
foreach($this->hidePagesNot as $state) {
|
if(!$showHidden) continue;
|
||||||
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->systemIDs[$id])) {
|
} else if(isset($this->systemIDs[$id])) {
|
||||||
if($this->superuser) $extraPages[$id] = $page;
|
if($this->superuser) $extraPages[$id] = $page;
|
||||||
|
Reference in New Issue
Block a user