You are here

public static function PreExistingConfigException::create in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Config/PreExistingConfigException.php \Drupal\Core\Config\PreExistingConfigException::create()

Creates an exception for an extension and a list of configuration objects.

Parameters

$extension: The name of the extension that is being installed.

array $config_objects: A list of configuration objects that already exist in active configuration, keyed by config collection.

Return value

$this

1 call to PreExistingConfigException::create()
ConfigInstaller::checkConfigurationToInstall in core/lib/Drupal/Core/Config/ConfigInstaller.php
Checks the configuration that will be installed for an extension.

File

core/lib/Drupal/Core/Config/PreExistingConfigException.php, line 58

Class

PreExistingConfigException
An exception thrown if configuration with the same name already exists.

Namespace

Drupal\Core\Config

Code

public static function create($extension, array $config_objects) {
  $message = new FormattableMarkup('Configuration objects (@config_names) provided by @extension already exist in active configuration', [
    '@config_names' => implode(', ', static::flattenConfigObjects($config_objects)),
    '@extension' => $extension,
  ]);
  $e = new static($message);
  $e->configObjects = $config_objects;
  $e->extension = $extension;
  return $e;
}