mirror of
https://github.com/getgrav/grav.git
synced 2026-07-08 16:31:33 +02:00
Fix natural sort when > 100 pages (#1564)
* Fix natural sort when > 100 pages * Revert manual and default sort type * Only check prefix numbers
This commit is contained in:
committed by
Andy Miller
parent
4332dd07a9
commit
287a51148a
@@ -1257,6 +1257,12 @@ class Pages
|
||||
$locale = setlocale(LC_COLLATE, 0); //`setlocale` with a 0 param returns the current locale set
|
||||
$col = Collator::create($locale);
|
||||
if ($col) {
|
||||
if (($sort_flags & SORT_NATURAL) === SORT_NATURAL) {
|
||||
$list = preg_replace_callback('~([0-9]+)\.~', function($number) {
|
||||
return sprintf('%032d', $number);
|
||||
}, $list);
|
||||
}
|
||||
|
||||
$col->asort($list, $sort_flags);
|
||||
} else {
|
||||
asort($list, $sort_flags);
|
||||
|
||||
Reference in New Issue
Block a user