ConfigFactory
class ConfigFactory implements ConfigFactoryInterface, EventSubscriberInterface (View source)
Defines the configuration object factory.
The configuration object factory instantiates a Config object for each configuration object name that is accessed and returns it to callers.
Properties
| protected StorageInterface | $storage | A storage instance for reading and writing configuration data. |
|
| protected EventDispatcherInterface | $eventDispatcher | An event dispatcher instance to use for configuration events. |
|
| protected Config[] | $cache | Cached configuration objects. |
|
| protected TypedConfigManagerInterface | $typedConfigManager | The typed config manager. |
|
| protected ConfigFactoryOverrideInterface[] | $configFactoryOverrides | An array of config factory override objects ordered by priority. |
Methods
Constructs the Config factory.
Returns a mutable configuration object for a given name.
Returns an immutable configuration object for a given name.
Returns a configuration object for a given name.
Returns a list of configuration objects for the given names.
Returns a list of configuration objects for the given names.
Get arbitrary overrides for the named configuration objects from modules.
Propagates cacheability of config overrides to cached config objects.
Resets and re-initializes configuration objects. Internal use only.
Renames a configuration object using the storage.
The cache keys associated with the state of the config factory.
Gets the static cache key for a given config name.
Gets all the cache keys that match the provided config name.
Clears the config factory static cache.
Gets configuration object names starting with a given prefix.
Updates stale static cache entries when configuration is saved.
Removes stale static cache entries when configuration is deleted.
{@inheritdoc}
Adds config factory override services.
Creates a configuration object.
Details
__construct(StorageInterface $storage, EventDispatcherInterface $event_dispatcher, TypedConfigManagerInterface $typed_config)
Constructs the Config factory.
Config
getEditable(string $name)
Returns a mutable configuration object for a given name.
Should not be used for config that will have runtime effects. Therefore it is always loaded override free.
ImmutableConfig
get(string $name)
Returns an immutable configuration object for a given name.
protected Config|ImmutableConfig
doGet(string $name, bool $immutable = TRUE)
Returns a configuration object for a given name.
ImmutableConfig[]
loadMultiple(array $names)
Returns a list of configuration objects for the given names.
This will pre-load all requested configuration objects does not create new configuration objects. This method always return immutable objects. ConfigFactoryInterface::getEditable() should be used to retrieve mutable configuration objects, one by one.
protected Config[]|ImmutableConfig[]
doLoadMultiple(array $names, bool $immutable = TRUE)
Returns a list of configuration objects for the given names.
protected array
loadOverrides(array $names)
Get arbitrary overrides for the named configuration objects from modules.
protected
propagateConfigOverrideCacheability(string $cache_key, string $name)
Propagates cacheability of config overrides to cached config objects.
$this
reset(string|null $name = NULL)
Resets and re-initializes configuration objects. Internal use only.
$this
rename(string $old_name, string $new_name)
Renames a configuration object using the storage.
array
getCacheKeys()
The cache keys associated with the state of the config factory.
All state information that can influence the result of a get() should be included. Typically, this includes a key for each override added via addOverride(). This allows external code to maintain caches of configuration data in addition to or instead of caches maintained by the factory.
protected string
getConfigCacheKey(string $name, bool $immutable)
Gets the static cache key for a given config name.
protected array
getConfigCacheKeys(string $name)
Gets all the cache keys that match the provided config name.
$this
clearStaticCache()
Clears the config factory static cache.
array
listAll(string $prefix = '')
Gets configuration object names starting with a given prefix.
onConfigSave(ConfigCrudEvent $event)
Updates stale static cache entries when configuration is saved.
onConfigDelete(ConfigCrudEvent $event)
Removes stale static cache entries when configuration is deleted.
static array
getSubscribedEvents()
{@inheritdoc}
addOverride(ConfigFactoryOverrideInterface $config_factory_override)
Adds config factory override services.
protected Config|ImmutableConfig
createConfigObject(string $name, bool $immutable)
Creates a configuration object.