Skip to content

Commit

Permalink
folders in tree view should be sorted by names
Browse files Browse the repository at this point in the history
  • Loading branch information
streamtw committed Apr 28, 2017
1 parent c91f416 commit bc3d597
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/controllers/FolderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,15 @@ public function getFolders()
foreach ($folder_types as $folder_type => $lang_key) {
$root_folder_path = parent::getRootFolderPath($folder_type);

$children = parent::getDirectories($root_folder_path);
usort($children, function ($a, $b) {
return strcmp($a->name, $b->name);
});

array_push($root_folders, (object)[
'name' => trans('laravel-filemanager::lfm.title-' . $lang_key),
'path' => parent::getInternalPath($root_folder_path),
'children' => parent::getDirectories($root_folder_path),
'children' => $children,
'has_next' => !($lang_key == end($folder_types))
]);
}
Expand Down

0 comments on commit bc3d597

Please sign in to comment.