Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. PreExistingConfigException.php

function 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.

1 call to PreExistingConfigException::flattenConfigObjects()
PreExistingConfigException::create in core/lib/Drupal/Core/Config/PreExistingConfigException.php
Creates an exception for an extension and a list of configuration objects.

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 = [];
    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[] = $config_names;
    }
    return array_merge(...$flat_config_objects);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal