Unverified Commit 8cd44d48 authored by Alex Pott's avatar Alex Pott
Browse files

fix: #2265487 ConfigEntity based lists with items containing non-ascii...

fix: #2265487 ConfigEntity based lists with items containing non-ascii characters are not sorted correctly

By: nlambert
By: catch
By: sleitner
By: longwave
By: smustgrave
By: quietone
By: larowlan
By: acbramley
By: penyaskito
By: sonam.chaturvedi
By: tanuj.
By: alexpott
By: nicxvan
parent 073a7d38
Loading
Loading
Loading
Loading
Loading
+4 −1
Changes for composer.lock: 4 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -368,7 +368,7 @@
            "dist": {
                "type": "path",
                "url": "core",
                "reference": "56fdfed7e4ef932dad548e43ec17949f843b89eb"
                "reference": "7839b79d4c57dac47e84ef01c2f5a912cbecdc47"
            },
            "require": {
                "asm89/stack-cors": "^2.3",
@@ -455,6 +455,9 @@
                "drupal/core-uuid": "self.version",
                "drupal/core-version": "self.version"
            },
            "suggest": {
                "ext-intl": "Improves sorting of non-english languages."
            },
            "bin": [
                "scripts/dr"
            ],
+3 −0
Changes for core/composer.json: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -129,6 +129,9 @@
    "config": {
        "preferred-install": "dist"
    },
    "suggest": {
        "ext-intl": "Improves sorting of non-english languages."
    },
    "extra": {
        "branch-alias": {
            "dev-main": "12.x-dev"
+2 −1
Changes for core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
use Drupal\Core\Plugin\PluginDependencyTrait;
use Drupal\Core\Plugin\RemovableDependentPluginReturn;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\Utility\NaturalSort;

/**
 * Defines a base configuration entity class.
@@ -248,7 +249,7 @@ public static function sort(ConfigEntityInterface $a, ConfigEntityInterface $b)
    if ($a_weight == $b_weight) {
      $a_label = $a->label() ?? '';
      $b_label = $b->label() ?? '';
      return strnatcasecmp($a_label, $b_label);
      return NaturalSort::strnatcasecmp($a_label, $b_label);
    }
    return $a_weight <=> $b_weight;
  }
+2 −1
Changes for core/lib/Drupal/Core/Datetime/Entity/DateFormat.php: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@
use Drupal\Core\Config\Entity\ConfigEntityBase;
use Drupal\Core\Config\Entity\ConfigEntityInterface;
use Drupal\Core\Datetime\DateFormatInterface;
use Drupal\Core\Utility\NaturalSort;
use Drupal\system\DateFormatAccessControlHandler;

/**
@@ -88,7 +89,7 @@ public static function sort(ConfigEntityInterface $a, ConfigEntityInterface $b)
    if ($a->isLocked() == $b->isLocked()) {
      $a_label = $a->label();
      $b_label = $b->label();
      return strnatcasecmp($a_label, $b_label);
      return NaturalSort::strnatcasecmp($a_label, $b_label);
    }
    return $a->isLocked() ? 1 : -1;
  }
+2 −1
Changes for core/lib/Drupal/Core/Entity/EntityDisplayModeBase.php: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@

use Drupal\Core\Config\Entity\ConfigEntityBase;
use Drupal\Core\Config\Entity\ConfigEntityInterface;
use Drupal\Core\Utility\NaturalSort;

/**
 * Base class for config entity types with settings for form and view modes.
@@ -66,7 +67,7 @@ public static function sort(ConfigEntityInterface $a, ConfigEntityInterface $b)
    // Sort by the type of entity the view mode is used for.
    $a_type = $a->getTargetType();
    $b_type = $b->getTargetType();
    $type_order = strnatcasecmp($a_type, $b_type);
    $type_order = NaturalSort::strnatcasecmp($a_type, $b_type);
    return $type_order != 0 ? $type_order : parent::sort($a, $b);
  }

Loading