mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-10-27 16:26:32 +01:00
Add children flag in parent field data response
This commit is contained in:
@@ -2366,7 +2366,8 @@ class AdminController extends AdminBaseController
|
||||
'extension' => '',
|
||||
'type' => 'root',
|
||||
'modified' => $fileInfo->getMTime(),
|
||||
'size' => 0
|
||||
'size' => 0,
|
||||
'children' => false
|
||||
];
|
||||
} else {
|
||||
continue;
|
||||
@@ -2376,6 +2377,9 @@ 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);
|
||||
|
||||
$payload = [
|
||||
'name' => $file_page ? $file_page->title() : $fileName,
|
||||
'value' => $file_page ? $file_page->rawRoute() : $file_path,
|
||||
@@ -2385,7 +2389,8 @@ class AdminController extends AdminBaseController
|
||||
'type' => $type,
|
||||
'modified' => $fileInfo->getMTime(),
|
||||
'size' => $fileInfo->getSize(),
|
||||
'symlink' => false
|
||||
'symlink' => false,
|
||||
'children' => $has_children
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user