ConfigDependencyManager::sortGraphByWeight

protected static ConfigDependencyManager::sortGraphByWeight(array $a, array $b)

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, will be removed before 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;
}
doc_Drupal
2016-10-29 08:52:21
Comments
Leave a Comment

Please login to continue.