Skip to content

Commit

Permalink
Make the tree sorting case-insensitive (fixes #103)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-H committed Mar 16, 2021
1 parent fc29cb6 commit 3f9713d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"ext-pdo": "*",
"ext-sqlite3": "*",
"ext-fileinfo": "*",
"ext-mbstring": "*",
"slim/slim": "^3.1",
"slim/php-view": "^2.0",
"slim/twig-view": "^2.3",
Expand Down
7 changes: 5 additions & 2 deletions src/Navigation/Tree.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,10 @@ private static function _getNestedItems($root, $directoryPrefix, $directoryPath,
}

if (!$so1 && !$so2) {
return strnatcmp($item['title'], $item2['title']);
return strnatcmp(
mb_strtolower($item['title']),
mb_strtolower($item2['title'])
);
}

return $so1 - $so2;
Expand Down Expand Up @@ -221,5 +224,5 @@ public function getAllItems()
}
return $return;
}

}

0 comments on commit 3f9713d

Please sign in to comment.