function ConfigManager::findMissingContentDependencies

Same name in other branches
  1. 9 core/lib/Drupal/Core/Config/ConfigManager.php \Drupal\Core\Config\ConfigManager::findMissingContentDependencies()
  2. 8.9.x core/lib/Drupal/Core/Config/ConfigManager.php \Drupal\Core\Config\ConfigManager::findMissingContentDependencies()
  3. 11.x core/lib/Drupal/Core/Config/ConfigManager.php \Drupal\Core\Config\ConfigManager::findMissingContentDependencies()

File

core/lib/Drupal/Core/Config/ConfigManager.php, line 495

Class

ConfigManager
The ConfigManager provides helper functions for the configuration system.

Namespace

Drupal\Core\Config

Code

public function findMissingContentDependencies() {
    $content_dependencies = [];
    $missing_dependencies = [];
    foreach ($this->activeStorage
        ->readMultiple($this->activeStorage
        ->listAll()) as $config_data) {
        if (isset($config_data['dependencies']['content'])) {
            $content_dependencies[] = $config_data['dependencies']['content'];
        }
        if (isset($config_data['dependencies']['enforced']['content'])) {
            $content_dependencies[] = $config_data['dependencies']['enforced']['content'];
        }
    }
    $unique_content_dependencies = array_unique(array_merge(...$content_dependencies));
    foreach ($unique_content_dependencies as $content_dependency) {
        // Format of the dependency is entity_type:bundle:uuid.
        [
            $entity_type,
            $bundle,
            $uuid,
        ] = explode(':', $content_dependency, 3);
        if (!$this->entityRepository
            ->loadEntityByUuid($entity_type, $uuid)) {
            $missing_dependencies[$uuid] = [
                'entity_type' => $entity_type,
                'bundle' => $bundle,
                'uuid' => $uuid,
            ];
        }
    }
    return $missing_dependencies;
}

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