1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-24 15:23:11 +02:00
This commit is contained in:
Ryan Cramer
2019-03-04 06:24:19 -05:00
parent 906640ecb7
commit c38c166c67

View File

@@ -120,14 +120,12 @@ class ProcessPageListRenderJSON extends ProcessPageListRender {
$config = $this->wire('config');
$idTrash = $config->trashPageID;
$id404 = $config->http404PageID;
$page404 = null;
foreach($this->children as $page) {
if(!$this->superuser && !$page->listable()) continue;
if($page->id == $id404 && !$this->superuser) {
// allow showing 404 page, only if it's editable
$page404 = $page;
if(!$page->editable()) continue;
} else if(in_array($page->id, $this->systemIDs)) {
if($this->superuser) $extraPages[$page->id] = $page;
@@ -137,10 +135,11 @@ class ProcessPageListRenderJSON extends ProcessPageListRender {
$child = $this->renderChild($page);
$children[] = $child;
}
if(!$this->superuser && $page404 && $page404->parent_id == 1 && !isset($extraPages[$idTrash])) {
// add in the trash page if not present and allowed
if($this->page->id === 1 && !$this->superuser && !isset($extraPages[$idTrash]) && $this->getUseTrash()) {
$pageTrash = $this->wire('pages')->get($idTrash);
if($pageTrash->id && $this->getUseTrash() && $pageTrash->listable()) {
if($pageTrash->id && $pageTrash->listable()) {
$extraPages[$pageTrash->id] = $pageTrash;
}
}