Skip to content

Commit bc3d597

Browse files
committed
folders in tree view should be sorted by names
1 parent c91f416 commit bc3d597

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/controllers/FolderController.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,15 @@ public function getFolders()
2929
foreach ($folder_types as $folder_type => $lang_key) {
3030
$root_folder_path = parent::getRootFolderPath($folder_type);
3131

32+
$children = parent::getDirectories($root_folder_path);
33+
usort($children, function ($a, $b) {
34+
return strcmp($a->name, $b->name);
35+
});
36+
3237
array_push($root_folders, (object)[
3338
'name' => trans('laravel-filemanager::lfm.title-' . $lang_key),
3439
'path' => parent::getInternalPath($root_folder_path),
35-
'children' => parent::getDirectories($root_folder_path),
40+
'children' => $children,
3641
'has_next' => !($lang_key == end($folder_types))
3742
]);
3843
}

0 commit comments

Comments
 (0)