Skip to content

Commit

Permalink
Fix #784 ordering in page collections
Browse files Browse the repository at this point in the history
Fixes accentuated characters ordering and also uppercase letters being
put first.

Re-done implementation made in
fc5302f
6a817ed but reverted in
894142d
6167ae2 due to extension not checked
  • Loading branch information
flaviocopes committed Apr 27, 2016
1 parent 98fb622 commit e2453b8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion system/src/Grav/Common/Page/Pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,12 @@ protected function buildSort($path, array $pages, $order_by = 'default', $manual
$list = $this->arrayShuffle($list);
} else {
// else just sort the list according to specified key
asort($list, $sort_flags);
if (extension_loaded('intl')) {
$col = new \Collator(setlocale(LC_COLLATE, 0)); //`setlocale` with a 0 param returns the current locale set
$col->asort($list, $sort_flags);
} else {
asort($list, $sort_flags);
}
}


Expand Down

0 comments on commit e2453b8

Please sign in to comment.