public static function PreExistingConfigException::flattenConfigObjects in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Config/PreExistingConfigException.php \Drupal\Core\Config\PreExistingConfigException::flattenConfigObjects()
- 9 core/lib/Drupal/Core/Config/PreExistingConfigException.php \Drupal\Core\Config\PreExistingConfigException::flattenConfigObjects()
Flattens the config object array to a single dimensional list.
Parameters
array $config_objects: A list of configuration objects that already exist in active configuration, keyed by config collection.
Return value
array A list of configuration objects that have been prefixed with their collection.
File
- core/
lib/ Drupal/ Core/ Config/ PreExistingConfigException.php, line 82
Class
- PreExistingConfigException
- An exception thrown if configuration with the same name already exists.
Namespace
Drupal\Core\ConfigCode
public static function flattenConfigObjects(array $config_objects) {
$flat_config_objects = [];
foreach ($config_objects as $collection => $config_names) {
$config_names = array_map(function ($config_name) use ($collection) {
if ($collection != StorageInterface::DEFAULT_COLLECTION) {
$config_name = str_replace('.', DIRECTORY_SEPARATOR, $collection) . DIRECTORY_SEPARATOR . $config_name;
}
return $config_name;
}, $config_names);
$flat_config_objects = array_merge($flat_config_objects, $config_names);
}
return $flat_config_objects;
}