Issue #2265487: ConfigEntity based lists with items containing non-ascii...
2 unresolved threads
Merge request reports
Activity
- Resolved by sleitner
- Resolved by sleitner
239 $collator = \Collator::create((!extension_loaded('intl')) ? ('en') : (\Drupal::service('language_manager')->getCurrentLanguage()->getId())); 240 return uasort($entities, function ($a, $b) use ($collator) { 241 return static::compare($a, $b, $collator); 242 }); 243 } 244 245 /** 246 * Callback for uasort() to compare configuration entities. 247 */ 248 public static function compare(ConfigEntityInterface $a, ConfigEntityInterface $b, \Collator $collator): int { 249 $a_weight = $a->weight ?? 0; 250 $b_weight = $b->weight ?? 0; 251 if ($a_weight == $b_weight) { 252 $a_label = $a->label() ?? ''; 253 $b_label = $b->label() ?? ''; 254 if (!extension_loaded('intl')) { added 7 commits
-
24e6690a...8d0e932f - 6 commits from branch
project:11.x
- 63697967 - Merge branch drupal:11.x into 2265487-configentity-based-lists
-
24e6690a...8d0e932f - 6 commits from branch
259 } 260 return $collator->compare($a_label, $b_label); 261 } 262 return $a_weight <=> $b_weight; 263 } 264 235 265 /** 236 266 * Callback for uasort() to sort configuration entities by weight and label. 267 * 268 * @deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Use 269 * \Drupal\Core\Config\Entity\ConfigEntityBase::sortEntities() instead. 270 * 271 * @see https://www.drupal.org/project/drupal/issues/2265487 237 272 */ 238 273 public static function sort(ConfigEntityInterface $a, ConfigEntityInterface $b) { 274 @trigger_error(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Use ' . __CLASS__ . '::sortEntities() instead. See https://www.drupal.org/project/drupal/issues/2265487', E_USER_DEPRECATED); added 34 commits
-
ec328405...fd1519be - 33 commits from branch
project:11.x
- 878099c4 - Merge branch drupal:11.x into 2265487-configentity-based-lists
-
ec328405...fd1519be - 33 commits from branch
added 28 commits
-
878099c4...ce26a90e - 27 commits from branch
project:11.x
- e4bfaae3 - Merge branch drupal:11.x into 2265487-configentity-based-lists
-
878099c4...ce26a90e - 27 commits from branch
Please register or sign in to reply