3 namespace Drupal\Core\Config;
6 * Defines the interface for a configuration object factory.
10 interface ConfigFactoryInterface {
13 * Returns an immutable configuration object for a given name.
16 * The name of the configuration object to construct.
18 * @return \Drupal\Core\Config\ImmutableConfig
19 * A configuration object.
21 public function get($name);
24 * Returns an mutable configuration object for a given name.
26 * Should not be used for config that will have runtime effects. Therefore it
27 * is always loaded override free.
30 * The name of the configuration object to construct.
32 * @return \Drupal\Core\Config\Config
33 * A configuration object.
35 public function getEditable($name);
38 * Returns a list of configuration objects for the given names.
40 * This will pre-load all requested configuration objects does not create
41 * new configuration objects. This method always return immutable objects.
42 * ConfigFactoryInterface::getEditable() should be used to retrieve mutable
43 * configuration objects, one by one.
46 * List of names of configuration objects.
48 * @return \Drupal\Core\Config\ImmutableConfig[]
49 * List of successfully loaded configuration objects, keyed by name.
51 public function loadMultiple(array $names);
54 * Resets and re-initializes configuration objects. Internal use only.
56 * @param string|null $name
57 * (optional) The name of the configuration object to reset. If omitted, all
58 * configuration objects are reset.
62 public function reset($name = NULL);
65 * Renames a configuration object using the storage.
67 * @param string $old_name
68 * The old name of the configuration object.
69 * @param string $new_name
70 * The new name of the configuration object.
74 public function rename($old_name, $new_name);
77 * The cache keys associated with the state of the config factory.
79 * All state information that can influence the result of a get() should be
80 * included. Typically, this includes a key for each override added via
81 * addOverride(). This allows external code to maintain caches of
82 * configuration data in addition to or instead of caches maintained by the
86 * An array of strings, used to generate a cache ID.
88 public function getCacheKeys();
91 * Clears the config factory static cache.
95 public function clearStaticCache();
98 * Gets configuration object names starting with a given prefix.
100 * @see \Drupal\Core\Config\StorageInterface::listAll()
102 * @param string $prefix
103 * (optional) The prefix to search for. If omitted, all configuration object
104 * names that exist are returned.
107 * An array containing matching configuration object names.
109 public function listAll($prefix = '');
112 * Adds config factory override services.
114 * @param \Drupal\Core\Config\ConfigFactoryOverrideInterface $config_factory_override
115 * The config factory override service to add. It is added at the end of the
116 * priority list (lower priority relative to existing ones).
118 public function addOverride(ConfigFactoryOverrideInterface $config_factory_override);