Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\Core\Config;
|
Chris@0
|
4
|
Chris@0
|
5 /**
|
Chris@0
|
6 * Interface for classes that install config.
|
Chris@0
|
7 */
|
Chris@0
|
8 interface ConfigInstallerInterface {
|
Chris@0
|
9
|
Chris@0
|
10 /**
|
Chris@0
|
11 * Installs the default configuration of a given extension.
|
Chris@0
|
12 *
|
Chris@0
|
13 * When an extension is installed, it searches all the default configuration
|
Chris@0
|
14 * directories for all other extensions to locate any configuration with its
|
Chris@0
|
15 * name prefix. For example, the Node module provides the frontpage view as a
|
Chris@0
|
16 * default configuration file:
|
Chris@0
|
17 * core/modules/node/config/install/views.view.frontpage.yml
|
Chris@0
|
18 * When the Views module is installed after the Node module is already
|
Chris@0
|
19 * enabled, the frontpage view will be installed.
|
Chris@0
|
20 *
|
Chris@0
|
21 * Additionally, the default configuration directory for the extension being
|
Chris@0
|
22 * installed is searched to discover if it contains default configuration
|
Chris@0
|
23 * that is owned by other enabled extensions. So, the frontpage view will also
|
Chris@0
|
24 * be installed when the Node module is installed after Views.
|
Chris@0
|
25 *
|
Chris@0
|
26 * @param string $type
|
Chris@0
|
27 * The extension type; e.g., 'module' or 'theme'.
|
Chris@0
|
28 * @param string $name
|
Chris@0
|
29 * The name of the module or theme to install default configuration for.
|
Chris@0
|
30 *
|
Chris@0
|
31 * @see \Drupal\Core\Config\ExtensionInstallStorage
|
Chris@0
|
32 */
|
Chris@0
|
33 public function installDefaultConfig($type, $name);
|
Chris@0
|
34
|
Chris@0
|
35 /**
|
Chris@0
|
36 * Installs optional configuration.
|
Chris@0
|
37 *
|
Chris@0
|
38 * Optional configuration is only installed if:
|
Chris@0
|
39 * - the configuration does not exist already.
|
Chris@0
|
40 * - it's a configuration entity.
|
Chris@0
|
41 * - its dependencies can be met.
|
Chris@0
|
42 *
|
Chris@0
|
43 * @param \Drupal\Core\Config\StorageInterface $storage
|
Chris@0
|
44 * (optional) The configuration storage to search for optional
|
Chris@0
|
45 * configuration. If not provided, all enabled extension's optional
|
Chris@17
|
46 * configuration directories including the install profile's will be
|
Chris@17
|
47 * searched.
|
Chris@0
|
48 * @param array $dependency
|
Chris@0
|
49 * (optional) If set, ensures that the configuration being installed has
|
Chris@0
|
50 * this dependency. The format is dependency type as the key ('module',
|
Chris@0
|
51 * 'theme', or 'config') and the dependency name as the value
|
Chris@0
|
52 * ('book', 'bartik', 'views.view.frontpage').
|
Chris@0
|
53 */
|
Chris@0
|
54 public function installOptionalConfig(StorageInterface $storage = NULL, $dependency = []);
|
Chris@0
|
55
|
Chris@0
|
56 /**
|
Chris@0
|
57 * Installs all default configuration in the specified collection.
|
Chris@0
|
58 *
|
Chris@0
|
59 * The function is useful if the site needs to respond to an event that has
|
Chris@0
|
60 * just created another collection and we need to check all the installed
|
Chris@0
|
61 * extensions for any matching configuration. For example, if a language has
|
Chris@0
|
62 * just been created.
|
Chris@0
|
63 *
|
Chris@0
|
64 * @param string $collection
|
Chris@0
|
65 * The configuration collection.
|
Chris@0
|
66 */
|
Chris@0
|
67 public function installCollectionDefaultConfig($collection);
|
Chris@0
|
68
|
Chris@0
|
69 /**
|
Chris@0
|
70 * Sets the configuration storage that provides the default configuration.
|
Chris@0
|
71 *
|
Chris@0
|
72 * @param \Drupal\Core\Config\StorageInterface $storage
|
Chris@0
|
73 *
|
Chris@0
|
74 * @return $this
|
Chris@0
|
75 */
|
Chris@0
|
76 public function setSourceStorage(StorageInterface $storage);
|
Chris@0
|
77
|
Chris@0
|
78 /**
|
Chris@18
|
79 * Gets the configuration storage that provides the default configuration.
|
Chris@18
|
80 *
|
Chris@18
|
81 * @return \Drupal\Core\Config\StorageInterface|null
|
Chris@18
|
82 * The configuration storage that provides the default configuration.
|
Chris@18
|
83 * Returns null if the source storage has not been set.
|
Chris@18
|
84 */
|
Chris@18
|
85 public function getSourceStorage();
|
Chris@18
|
86
|
Chris@18
|
87 /**
|
Chris@0
|
88 * Sets the status of the isSyncing flag.
|
Chris@0
|
89 *
|
Chris@0
|
90 * @param bool $status
|
Chris@0
|
91 * The status of the sync flag.
|
Chris@0
|
92 *
|
Chris@0
|
93 * @return $this
|
Chris@0
|
94 */
|
Chris@0
|
95 public function setSyncing($status);
|
Chris@0
|
96
|
Chris@0
|
97 /**
|
Chris@0
|
98 * Gets the syncing state.
|
Chris@0
|
99 *
|
Chris@0
|
100 * @return bool
|
Chris@0
|
101 * Returns TRUE is syncing flag set.
|
Chris@0
|
102 */
|
Chris@0
|
103 public function isSyncing();
|
Chris@0
|
104
|
Chris@0
|
105 /**
|
Chris@0
|
106 * Checks the configuration that will be installed for an extension.
|
Chris@0
|
107 *
|
Chris@0
|
108 * @param string $type
|
Chris@0
|
109 * Type of extension to install.
|
Chris@0
|
110 * @param string $name
|
Chris@0
|
111 * Name of extension to install.
|
Chris@0
|
112 *
|
Chris@0
|
113 * @throws \Drupal\Core\Config\UnmetDependenciesException
|
Chris@0
|
114 * @throws \Drupal\Core\Config\PreExistingConfigException
|
Chris@0
|
115 */
|
Chris@0
|
116 public function checkConfigurationToInstall($type, $name);
|
Chris@0
|
117
|
Chris@0
|
118 }
|