function ConfigDependencyManager::sortGraphByWeight

Sorts the dependency graph by weight and alphabetically.

Parameters

array $a: First item for comparison. The compared items should be associative arrays that include a 'weight' and a 'name' key.

array $b: Second item for comparison.

Return value

int The comparison result for uasort().

Deprecated

in drupal:8.2.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Config\Entity\ConfigDependencyManager::prepareMultisort() and array_multisort() instead.

File

core/lib/Drupal/Core/Config/Entity/ConfigDependencyManager.php, line 238

Class

ConfigDependencyManager
Provides a class to discover configuration entity dependencies.

Namespace

Drupal\Core\Config\Entity

Code

protected static function sortGraphByWeight(array $a, array $b) {
    $weight_cmp = SortArray::sortByKeyInt($a, $b, 'weight');
    if ($weight_cmp === 0) {
        return SortArray::sortByKeyString($a, $b, 'name');
    }
    return $weight_cmp;
}

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