Fixed wrong ordering in page collections if intl extension has been enabled [#3167]

This commit is contained in:
Matias Griese 2021-02-01 14:59:03 +02:00
parent 72b1a18744
commit 76e887e3fb
3 changed files with 3 additions and 0 deletions

View File

@ -12,6 +12,7 @@
* Fixed saving page in expert mode [#3174](https://github.com/getgrav/grav/issues/3174)
* Fixed exception in `$flexPage->frontmatter()` method when setting value
* Fixed `onBlueprintCreated` event being called multiple times in `Flex Pages` [grav-plugin-flex-objects#97](https://github.com/trilbymedia/grav-plugin-flex-objects/issues/97)
* Fixed wrong ordering in page collections if `intl` extension has been enabled [#3167](https://github.com/getgrav/grav/issues/3167)
# v1.7.3
## 01/21/2021

View File

@ -362,6 +362,7 @@ class PageCollection extends FlexPageCollection implements PageCollectionInterfa
$locale = setlocale(LC_COLLATE, '0'); //`setlocale` with a '0' param returns the current locale set
$col = Collator::create($locale);
if ($col) {
$col->setAttribute(Collator::NUMERIC_COLLATION, Collator::ON);
if (($sort_flags & SORT_NATURAL) === SORT_NATURAL) {
$list = preg_replace_callback('~([0-9]+)\.~', static function ($number) {
return sprintf('%032d.', $number[0]);

View File

@ -1955,6 +1955,7 @@ class Pages
$locale = setlocale(LC_COLLATE, '0'); //`setlocale` with a '0' param returns the current locale set
$col = Collator::create($locale);
if ($col) {
$col->setAttribute(Collator::NUMERIC_COLLATION, Collator::ON);
if (($sort_flags & SORT_NATURAL) === SORT_NATURAL) {
$list = preg_replace_callback('~([0-9]+)\.~', static function ($number) {
return sprintf('%032d.', $number[0]);