ConfigDependencyManager::getGraph

protected ConfigDependencyManager::getGraph()

Gets the dependency graph of all the config entities.

Return value

array The dependency graph of all the config entities.

File

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

Class

ConfigDependencyManager
Provides a class to discover configuration entity dependencies.

Namespace

Drupal\Core\Config\Entity

Code

protected function getGraph() {
  if (!isset($this->graph)) {
    $graph = array();
    foreach ($this->data as $entity) {
      $graph_key = $entity->getConfigDependencyName();
      if (!isset($graph[$graph_key])) {
        $graph[$graph_key] = [
          'edges' => [],
          'name' => $graph_key,
        ];
      }
      // Include all dependencies in the graph so that topographical sorting
      // works.
      foreach (array_merge($entity->getDependencies('config'), $entity->getDependencies('module'), $entity->getDependencies('theme')) as $dependency) {
        $graph[$dependency]['edges'][$graph_key] = TRUE;
        $graph[$dependency]['name'] = $dependency;
      }
    }
    // Ensure that order of the graph is consistent.
    krsort($graph);
    $graph_object = new Graph($graph);
    $this->graph = $graph_object->searchAndSort();
  }
  return $this->graph;
}
doc_Drupal
2016-10-29 08:52:20
Comments
Leave a Comment

Please login to continue.