protected ConfigInstaller::validateDependencies($config_name, array $data, array $enabled_extensions, array $all_config)
Validates an array of config data that contains dependency information.
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
bool TRUE if the dependencies are met, FALSE if not.
File
- core/lib/Drupal/Core/Config/ConfigInstaller.php, line 513
Class
Namespace
Drupal\Core\Config
Code
protected function validateDependencies($config_name, array $data, array $enabled_extensions, array $all_config) {
list($provider) = explode('.', $config_name, 2);
if (isset($data['dependencies'])) {
$all_dependencies = $data['dependencies'];
// Ensure enforced dependencies are included.
if (isset($all_dependencies['enforced'])) {
$all_dependencies = array_merge($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'])) {
$all_dependencies['module'][] = $provider;
}
elseif (!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_diff($dependencies, $list_to_check);
if (!empty($missing)) {
return FALSE;
}
}
}
}
else {
// Simple config or a config entity without dependencies.
return in_array($provider, $enabled_extensions, TRUE);
}
return TRUE;
}
Please login to continue.