PreExistingConfigException::flattenConfigObjects

public static PreExistingConfigException::flattenConfigObjects(array $config_objects)

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\Config

Code

public static function flattenConfigObjects(array $config_objects) {
  $flat_config_objects = array();
  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;
}
doc_Drupal
2016-10-29 09:34:51
Comments
Leave a Comment

Please login to continue.