Fixes for broken parents field

This commit is contained in:
Andy Miller
2020-05-22 10:32:30 -06:00
parent 922383187d
commit 0cfc7e031c

View File

@@ -2437,8 +2437,8 @@ class AdminController extends AdminBaseController
$file_path = Utils::replaceFirstOccurrence(GRAV_ROOT, '', $filePath);
$type = $fileInfo->getType();
$child_path = $file_page ? GRAV_ROOT . $file_page->path() : $filePath;
$has_children = Folder::hasChildren($child_path);
$child_path = $file_page ? $file_page->path() : $filePath;
$count_children = Folder::countChildren($child_path);
$payload = [
'name' => $file_page ? $file_page->title() : $fileName,
@@ -2448,9 +2448,9 @@ class AdminController extends AdminBaseController
'extension' => $type === 'dir' ? '' : $fileInfo->getExtension(),
'type' => $type,
'modified' => $fileInfo->getMTime(),
'size' => $fileInfo->getSize(),
'size' => $count_children,
'symlink' => false,
'has-children' => $has_children
'has-children' => $count_children > 0
];
}