protected function 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 272

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;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Config!Entity!ConfigDependencyManager.php/function/ConfigDependencyManager::getGraph/8.1.x