Fixed root showing in multiple columns

This commit is contained in:
Andy Miller
2019-06-06 16:38:03 -06:00
parent 9b606642be
commit ee4fd383c3

View File

@@ -1455,6 +1455,7 @@ class AdminController extends AdminBaseController
$children = null; $children = null;
$sub_route = null; $sub_route = null;
$extra = null; $extra = null;
$root = false;
// Handle leaf_route // Handle leaf_route
if ($leaf_route && $route != $leaf_route) { if ($leaf_route && $route != $leaf_route) {
@@ -1471,6 +1472,7 @@ class AdminController extends AdminBaseController
if (!$route) { if (!$route) {
$is_page = false; $is_page = false;
$route = $this->grav['locator']->findResource('page://', true); $route = $this->grav['locator']->findResource('page://', true);
$root = true;
} }
if ($is_page) { if ($is_page) {
@@ -1500,20 +1502,20 @@ class AdminController extends AdminBaseController
} }
if ($fileInfo->isDot()) { if ($fileInfo->isDot()) {
if (!$initial) { if ($root) {
$payload = [
'name' => '<root>',
'value' => '',
'item-key' => '',
'filename' => '.',
'extension' => '',
'type' => 'root',
'modified' => $fileInfo->getMTime(),
'size' => 0
];
} else {
continue; continue;
} }
$payload = [
'name' => '<root>',
'value' => '',
'item-key' => '',
'filename' => '.',
'extension' => '',
'type' => 'root',
'modified' => $fileInfo->getMTime(),
'size' => 0
];
} else { } else {
$file_page = $page_instances[$fileInfo->getPathname()] ?? null; $file_page = $page_instances[$fileInfo->getPathname()] ?? null;
$file_path = Utils::replaceFirstOccurrence(GRAV_ROOT, '', $fileInfo->getPathname()); $file_path = Utils::replaceFirstOccurrence(GRAV_ROOT, '', $fileInfo->getPathname());