You are here

public static function ExtensionList::sortByName in Drupal 10

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Extension/ExtensionList.php \Drupal\Core\Extension\ExtensionList::sortByName()

Array sorting callback; sorts extensions by their name.

Parameters

\Drupal\Core\Extension\Extension $a: The first extension to compare.

\Drupal\Core\Extension\Extension $b: The second extension to compare.

Return value

int Less than 0 if $a is less than $b, more than 0 if $a is greater than $b, and 0 if they are equal.

File

core/lib/Drupal/Core/Extension/ExtensionList.php, line 595

Class

ExtensionList
Provides available extensions.

Namespace

Drupal\Core\Extension

Code

public static function sortByName(Extension $a, Extension $b) : int {
  return strcasecmp($a->info['name'], $b->info['name']);
}