interface ConfigFactoryInterface (View source)

Defines the interface for a configuration object factory.

Methods

get(string $name)

Returns an immutable configuration object for a given name.

getEditable(string $name)

Returns a mutable configuration object for a given name.

loadMultiple(array $names)

Returns a list of configuration objects for the given names.

$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.

$this
clearStaticCache()

Clears the config factory static cache.

array
listAll(string $prefix = '')

Gets configuration object names starting with a given prefix.

addOverride(ConfigFactoryOverrideInterface $config_factory_override)

Adds config factory override services.

Details

ImmutableConfig get(string $name)

Returns an immutable configuration object for a given name.

Parameters

string $name

The name of the configuration object to construct.

Return Value

ImmutableConfig

A configuration object.

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.

Parameters

string $name

The name of the configuration object to construct.

Return Value

Config

A configuration object.

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.

Parameters

array $names

List of names of configuration objects.

Return Value

ImmutableConfig[]

List of successfully loaded configuration objects, keyed by name.

$this reset(string|null $name = NULL)

Resets and re-initializes configuration objects. Internal use only.

Parameters

string|null $name

(optional) The name of the configuration object to reset. If omitted, all configuration objects are reset.

Return Value

$this

$this rename(string $old_name, string $new_name)

Renames a configuration object using the storage.

Parameters

string $old_name

The old name of the configuration object.

string $new_name

The new name of the configuration object.

Return Value

$this

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.

Return Value

array

An array of strings, used to generate a cache ID.

$this clearStaticCache()

Clears the config factory static cache.

Return Value

$this

array listAll(string $prefix = '')

Gets configuration object names starting with a given prefix.

Parameters

string $prefix

(optional) The prefix to search for. If omitted, all configuration object names that exist are returned.

Return Value

array

An array containing matching configuration object names.

See also

StorageInterface::listAll

addOverride(ConfigFactoryOverrideInterface $config_factory_override)

Adds config factory override services.

Parameters

ConfigFactoryOverrideInterface $config_factory_override

The config factory override service to add. It is added at the end of the priority list (lower priority relative to existing ones).