interface ConfigInstallerInterface (View source)

Interface for classes that install config.

Methods

installDefaultConfig(string $type, string $name)

Installs the default configuration of a given extension.

installOptionalConfig(StorageInterface $storage = NULL, array $dependency = [])

Installs optional configuration.

installCollectionDefaultConfig(string $collection)

Installs all default configuration in the specified collection.

$this
setSourceStorage(StorageInterface $storage)

Sets the configuration storage that provides the default configuration.

getSourceStorage()

Gets the configuration storage that provides the default configuration.

$this
setSyncing(bool $status)

Sets the status of the isSyncing flag.

bool
isSyncing()

Gets the syncing state.

checkConfigurationToInstall(string $type, string $name)

Checks the configuration that will be installed for an extension.

Details

installDefaultConfig(string $type, string $name)

Installs the default configuration of a given extension.

When an extension is installed, it searches all the default configuration directories for all other extensions to locate any configuration with its name prefix. For example, the Node module provides the frontpage view as a default configuration file: core/modules/node/config/optional/views.view.frontpage.yml When the Views module is installed after the Node module is already enabled, the frontpage view will be installed.

Additionally, the default configuration directory for the extension being installed is searched to discover if it contains default configuration that is owned by other enabled extensions. So, the frontpage view will also be installed when the Node module is installed after Views.

Parameters

string $type

The extension type; e.g., 'module' or 'theme'.

string $name

The name of the module or theme to install default configuration for.

See also

ExtensionInstallStorage

installOptionalConfig(StorageInterface $storage = NULL, array $dependency = [])

Installs optional configuration.

Optional configuration is only installed if:

  • the configuration does not exist already.
  • it's a configuration entity.
  • its dependencies can be met.

Parameters

StorageInterface $storage

(optional) The configuration storage to search for optional configuration. If not provided, all enabled extension's optional configuration directories including the install profile's will be searched.

array $dependency

(optional) If set, ensures that the configuration being installed has this dependency. The format is dependency type as the key ('module', 'theme', or 'config') and the dependency name as the value ('book', 'bartik', 'views.view.frontpage').

installCollectionDefaultConfig(string $collection)

Installs all default configuration in the specified collection.

The function is useful if the site needs to respond to an event that has just created another collection and we need to check all the installed extensions for any matching configuration. For example, if a language has just been created.

Parameters

string $collection

The configuration collection.

$this setSourceStorage(StorageInterface $storage)

Sets the configuration storage that provides the default configuration.

Parameters

StorageInterface $storage

The storage.

Return Value

$this

StorageInterface|null getSourceStorage()

Gets the configuration storage that provides the default configuration.

Return Value

StorageInterface|null

The configuration storage that provides the default configuration. Returns null if the source storage has not been set.

$this setSyncing(bool $status)

Sets the status of the isSyncing flag.

Parameters

bool $status

The status of the sync flag.

Return Value

$this

bool isSyncing()

Gets the syncing state.

Return Value

bool

Returns TRUE is syncing flag set.

checkConfigurationToInstall(string $type, string $name)

Checks the configuration that will be installed for an extension.

Parameters

string $type

Type of extension to install.

string $name

Name of extension to install.

Exceptions

UnmetDependenciesException
PreExistingConfigException