function ExtensionList::sortByName

Same name in other branches
  1. 9 core/lib/Drupal/Core/Extension/ExtensionList.php \Drupal\Core\Extension\ExtensionList::sortByName()
  2. 10 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.

1 method overrides ExtensionList::sortByName()
DatabaseDriverList::sortByName in core/lib/Drupal/Core/Extension/DatabaseDriverList.php
Array sorting callback; sorts extensions by their name.

File

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

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']);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.