Skip to content

Commit

Permalink
Hacky fix for #15154 until yiisoft/yii2#20191 is fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Jun 6, 2024
1 parent 147134f commit aa48f03
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Fixed a bug where element indexes’ “Date Created” columns were mislabeled as “Date Uploaded”. ([#15155](https://github.com/craftcms/cms/issues/15155))
- Fixed a bug where the content pane had extra padding on pages without a meta sidebar.
- Fixed a bug where reordered field layout tabs/elements weren’t getting saved. ([#15154](https://github.com/craftcms/cms/issues/15154))

## 5.2.0-beta.3 - 2024-06-04

Expand Down
1 change: 1 addition & 0 deletions bootstrap/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
$regularIconsPath = $iconsPath . DIRECTORY_SEPARATOR . 'regular';
$solidIconsPath = $iconsPath . DIRECTORY_SEPARATOR . 'solid';
require $libPath . DIRECTORY_SEPARATOR . 'yii2' . DIRECTORY_SEPARATOR . 'Yii.php';
require $libPath . DIRECTORY_SEPARATOR . 'yii2' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'ArrayHelper.php';
require $srcPath . DIRECTORY_SEPARATOR . 'Craft.php';

// Set aliases
Expand Down
36 changes: 36 additions & 0 deletions lib/yii2/helpers/ArrayHelper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
/**
* @link https://craftcms.com/
* @copyright Copyright (c) Pixel & Tonic, Inc.
* @license https://craftcms.github.io/license/
*/

namespace yii\helpers;

/**
* @inheritdoc
*/
class ArrayHelper extends BaseArrayHelper
{
public static function recursiveSort(array &$array, $sorter = null)
{
foreach ($array as &$value) {
if (is_array($value)) {
static::recursiveSort($value, $sorter);
}
}
unset($value);

if ($sorter === null) {
if (static::isIndexed($array)) {
// leave it alone for now, until https://github.com/yiisoft/yii2/issues/20191 is fixed
return $array;
}
$sorter = 'ksort';
}

call_user_func_array($sorter, [&$array]);

return $array;
}
}
1 change: 1 addition & 0 deletions src/test/TestSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ public static function configureCraft(): bool
$srcPath = $repoRoot . '/src';

require $libPath . '/yii2/Yii.php';
require $libPath . '/yii2/helpers/ArrayHelper.php';
require $srcPath . '/Craft.php';

// Set aliases
Expand Down

0 comments on commit aa48f03

Please sign in to comment.