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 including the install profile's will be
48 * @param array $dependency
49 * (optional) If set, ensures that the configuration being installed has
50 * this dependency. The format is dependency type as the key ('module',
51 * 'theme', or 'config') and the dependency name as the value
52 * ('book', 'bartik', 'views.view.frontpage').
54 public function installOptionalConfig(StorageInterface $storage = NULL, $dependency = []);
57 * Installs all default configuration in the specified collection.
59 * The function is useful if the site needs to respond to an event that has
60 * just created another collection and we need to check all the installed
61 * extensions for any matching configuration. For example, if a language has
64 * @param string $collection
65 * The configuration collection.
67 public function installCollectionDefaultConfig($collection);
70 * Sets the configuration storage that provides the default configuration.
72 * @param \Drupal\Core\Config\StorageInterface $storage
76 public function setSourceStorage(StorageInterface $storage);
79 * Sets the status of the isSyncing flag.
82 * The status of the sync flag.
86 public function setSyncing($status);
89 * Gets the syncing state.
92 * Returns TRUE is syncing flag set.
94 public function isSyncing();
97 * Checks the configuration that will be installed for an extension.
100 * Type of extension to install.
101 * @param string $name
102 * Name of extension to install.
104 * @throws \Drupal\Core\Config\UnmetDependenciesException
105 * @throws \Drupal\Core\Config\PreExistingConfigException
107 public function checkConfigurationToInstall($type, $name);