diff --git a/core/lib/Drupal/Core/Language/Language.php b/core/lib/Drupal/Core/Language/Language.php index 9bbc3ad..130774e 100644 --- a/core/lib/Drupal/Core/Language/Language.php +++ b/core/lib/Drupal/Core/Language/Language.php @@ -7,6 +7,8 @@ namespace Drupal\Core\Language; +use Drupal\Component\Utility\SortArray; + /** * An object containing the information for an interface language. * @@ -206,7 +208,6 @@ public function getNegotiationMethodId() { */ public function setNegotiationMethodId($method_id) { $this->method_id = $method_id; - return $this; } @@ -216,13 +217,10 @@ public function setNegotiationMethodId($method_id) { * @param array $languages * The array of language objects keyed by langcode. */ - public static function sort(LanguageInterface $a, LanguageInterface $b) { - if ($a->getWeight() == $b->getWeight()) { - return strnatcasecmp($a->getName(), $b->getName()); - } - else { - return $a->getWeight() < $b->getWeight() ? -1 : 1; - } + public static function sort(&$languages) { + uasort($languages, function ($a, $b) { + return SortArray::sortByWeightAndTitleKey($a, $b, 'weight', 'name'); + }); } }