3 namespace Drupal\Core\Config;
6 * Interface for classes that install config.
8 interface ConfigInstallerInterface {
11 * Installs the default configuration of a given extension.
13 * When an extension is installed, it searches all the default configuration
14 * directories for all other extensions to locate any configuration with its
15 * name prefix. For example, the Node module provides the frontpage view as a
16 * default configuration file:
17 * core/modules/node/config/install/views.view.frontpage.yml
18 * When the Views module is installed after the Node module is already
19 * enabled, the frontpage view will be installed.
21 * Additionally, the default configuration directory for the extension being
22 * installed is searched to discover if it contains default configuration
23 * that is owned by other enabled extensions. So, the frontpage view will also
24 * be installed when the Node module is installed after Views.
27 * The extension type; e.g., 'module' or 'theme'.
29 * The name of the module or theme to install default configuration for.
31 * @see \Drupal\Core\Config\ExtensionInstallStorage
33 public function installDefaultConfig($type, $name);
36 * Installs optional configuration.
38 * Optional configuration is only installed if:
39 * - the configuration does not exist already.
40 * - it's a configuration entity.
41 * - its dependencies can be met.
43 * @param \Drupal\Core\Config\StorageInterface $storage
44 * (optional) The configuration storage to search for optional
45 * configuration. If not provided, all enabled extension's optional
46 * configuration directories will be searched.
47 * @param array $dependency
48 * (optional) If set, ensures that the configuration being installed has
49 * this dependency. The format is dependency type as the key ('module',
50 * 'theme', or 'config') and the dependency name as the value
51 * ('book', 'bartik', 'views.view.frontpage').
53 public function installOptionalConfig(StorageInterface $storage = NULL, $dependency = []);
56 * Installs all default configuration in the specified collection.
58 * The function is useful if the site needs to respond to an event that has
59 * just created another collection and we need to check all the installed
60 * extensions for any matching configuration. For example, if a language has
63 * @param string $collection
64 * The configuration collection.
66 public function installCollectionDefaultConfig($collection);
69 * Sets the configuration storage that provides the default configuration.
71 * @param \Drupal\Core\Config\StorageInterface $storage
75 public function setSourceStorage(StorageInterface $storage);
78 * Sets the status of the isSyncing flag.
81 * The status of the sync flag.
85 public function setSyncing($status);
88 * Gets the syncing state.
91 * Returns TRUE is syncing flag set.
93 public function isSyncing();
96 * Checks the configuration that will be installed for an extension.
99 * Type of extension to install.
100 * @param string $name
101 * Name of extension to install.
103 * @throws \Drupal\Core\Config\UnmetDependenciesException
104 * @throws \Drupal\Core\Config\PreExistingConfigException
106 public function checkConfigurationToInstall($type, $name);