W3cubDocs

/Drupal 8

public function ConfigManager::findMissingContentDependencies

public ConfigManager::findMissingContentDependencies()

Finds missing content dependencies declared in configuration entities.

Return value

array A list of missing content dependencies. The array is keyed by UUID. Each value is an array with the following keys: 'entity_type', 'bundle' and 'uuid'.

Overrides ConfigManagerInterface::findMissingContentDependencies

File

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

Class

ConfigManager
The ConfigManager provides helper functions for the configuration system.

Namespace

Drupal\Core\Config

Code

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

© 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!ConfigManager.php/function/ConfigManager::findMissingContentDependencies/8.1.x