function ConfigDependencyManager::prepareMultisort

Same name in other branches
  1. 9 core/lib/Drupal/Core/Config/Entity/ConfigDependencyManager.php \Drupal\Core\Config\Entity\ConfigDependencyManager::prepareMultisort()
  2. 10 core/lib/Drupal/Core/Config/Entity/ConfigDependencyManager.php \Drupal\Core\Config\Entity\ConfigDependencyManager::prepareMultisort()
  3. 11.x core/lib/Drupal/Core/Config/Entity/ConfigDependencyManager.php \Drupal\Core\Config\Entity\ConfigDependencyManager::prepareMultisort()

Extracts data from the graph for use in array_multisort().

Parameters

array $graph: The graph to extract data from.

array $keys: The keys whose values to extract.

Return value

An array keyed by the $keys passed in. The values are arrays keyed by the row from the graph and the value is the corresponding value for the key from the graph.

2 calls to ConfigDependencyManager::prepareMultisort()
ConfigDependencyManager::getDependentEntities in core/lib/Drupal/Core/Config/Entity/ConfigDependencyManager.php
Gets dependencies.
ConfigDependencyManager::sortAll in core/lib/Drupal/Core/Config/Entity/ConfigDependencyManager.php
Sorts the dependencies in order of most dependent last.

File

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

Class

ConfigDependencyManager
Provides a class to discover configuration entity dependencies.

Namespace

Drupal\Core\Config\Entity

Code

protected function prepareMultisort($graph, $keys) {
    $return = array_fill_keys($keys, []);
    foreach ($graph as $graph_key => $graph_row) {
        foreach ($keys as $key) {
            $return[$key][$graph_key] = $graph_row[$key];
        }
    }
    return $return;
}

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