function ConfigInstaller::getMissingDependencies

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

Returns an array of missing dependencies for a config object.

Parameters

string $config_name: The name of the configuration object that is being validated.

array $data: Configuration data.

array $enabled_extensions: A list of all the currently enabled modules and themes.

array $all_config: A list of all the active configuration names.

Return value

array A list of missing config dependencies.

2 calls to ConfigInstaller::getMissingDependencies()
ConfigInstaller::findDefaultConfigWithUnmetDependencies in core/lib/Drupal/Core/Config/ConfigInstaller.php
Finds default configuration with unmet dependencies.
ConfigInstaller::validateDependencies in core/lib/Drupal/Core/Config/ConfigInstaller.php
Validates an array of config data that contains dependency information.

File

core/lib/Drupal/Core/Config/ConfigInstaller.php, line 616

Class

ConfigInstaller

Namespace

Drupal\Core\Config

Code

protected function getMissingDependencies($config_name, array $data, array $enabled_extensions, array $all_config) {
    $missing = [];
    if (isset($data['dependencies'])) {
        [
            $provider,
        ] = explode('.', $config_name, 2);
        $all_dependencies = $data['dependencies'];
        // Ensure enforced dependencies are included.
        if (isset($all_dependencies['enforced'])) {
            $all_dependencies = NestedArray::mergeDeep($all_dependencies, $data['dependencies']['enforced']);
            unset($all_dependencies['enforced']);
        }
        // Ensure the configuration entity type provider is in the list of
        // dependencies.
        if (!isset($all_dependencies['module']) || !in_array($provider, $all_dependencies['module'])) {
            $all_dependencies['module'][] = $provider;
        }
        foreach ($all_dependencies as $type => $dependencies) {
            $list_to_check = [];
            switch ($type) {
                case 'module':
                case 'theme':
                    $list_to_check = $enabled_extensions;
                    break;
                case 'config':
                    $list_to_check = $all_config;
                    break;
            }
            if (!empty($list_to_check)) {
                $missing = array_merge($missing, array_diff($dependencies, $list_to_check));
            }
        }
    }
    return $missing;
}

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