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