public static function 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;
}

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