Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Core/Config/Entity/ConfigDependencyManager.php \Drupal\Core\Config\Entity\ConfigDependencyManager::sortAll()
  2. 9 core/lib/Drupal/Core/Config/Entity/ConfigDependencyManager.php \Drupal\Core\Config\Entity\ConfigDependencyManager::sortAll()

Sorts the dependencies in order of most dependent last.

Return value

array The list of entities in order of most dependent last, otherwise alphabetical.

File

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

Class

ConfigDependencyManager
Provides a class to discover configuration entity dependencies.

Namespace

Drupal\Core\Config\Entity

Code

public function sortAll() {
  $graph = $this
    ->getGraph();

  // Sort by weight and alphabetically. The most dependent entities
  // are last and entities with the same weight are alphabetically ordered.
  $sorts = $this
    ->prepareMultisort($graph, [
    'weight',
    'name',
  ]);
  array_multisort($sorts['weight'], SORT_ASC, SORT_NUMERIC, $sorts['name'], SORT_ASC, SORT_NATURAL | SORT_FLAG_CASE, $graph);

  // Use array_intersect_key() to exclude modules and themes from the list.
  return array_keys(array_intersect_key($graph, $this->data));
}