class ImmutableConfig in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Config/ImmutableConfig.php \Drupal\Core\Config\ImmutableConfig
Defines the immutable configuration object.
Encapsulates all capabilities needed for runtime configuration handling except being able to change the configuration.
If you need to be able to change configuration use \Drupal\Core\Form\ConfigFormBaseTrait or \Drupal\Core\Config\ConfigFactoryInterface::getEditable().
Hierarchy
- class \Drupal\Core\Config\ConfigBase implements RefinableCacheableDependencyInterface uses RefinableCacheableDependencyTrait, DependencySerializationTrait
- class \Drupal\Core\Config\StorableConfigBase
- class \Drupal\Core\Config\Config
- class \Drupal\Core\Config\ImmutableConfig
- class \Drupal\Core\Config\Config
- class \Drupal\Core\Config\StorableConfigBase
Expanded class hierarchy of ImmutableConfig
See also
\Drupal\Core\Form\ConfigFormBaseTrait
\Drupal\Core\Config\ConfigFactoryInterface::getEditable()
\Drupal\Core\Config\ConfigFactoryInterface::get()
Related topics
7 files declare their use of ImmutableConfig
- ConfigEntityStorageTest.php in core/
tests/ Drupal/ Tests/ Core/ Config/ Entity/ ConfigEntityStorageTest.php - DateTimeIso8601NormalizerTest.php in core/
modules/ serialization/ tests/ src/ Unit/ Normalizer/ DateTimeIso8601NormalizerTest.php - DateTimeNormalizerTest.php in core/
modules/ serialization/ tests/ src/ Unit/ Normalizer/ DateTimeNormalizerTest.php - ImmutableConfigTest.php in core/
tests/ Drupal/ Tests/ Core/ Config/ ImmutableConfigTest.php - PathProcessorFrontTest.php in core/
tests/ Drupal/ Tests/ Core/ PathProcessor/ PathProcessorFrontTest.php
File
- core/
lib/ Drupal/ Core/ Config/ ImmutableConfig.php, line 21
Namespace
Drupal\Core\ConfigView source
class ImmutableConfig extends Config {
/**
* {@inheritdoc}
*/
public function set($key, $value) {
throw new ImmutableConfigException("Can not set values on immutable configuration {$this->getName()}:{$key}. Use \\Drupal\\Core\\Config\\ConfigFactoryInterface::getEditable() to retrieve a mutable configuration object");
}
/**
* {@inheritdoc}
*/
public function clear($key) {
throw new ImmutableConfigException("Can not clear {$key} key in immutable configuration {$this->getName()}. Use \\Drupal\\Core\\Config\\ConfigFactoryInterface::getEditable() to retrieve a mutable configuration object");
}
/**
* {@inheritdoc}
*/
public function save($has_trusted_data = FALSE) {
throw new ImmutableConfigException("Can not save immutable configuration {$this->getName()}. Use \\Drupal\\Core\\Config\\ConfigFactoryInterface::getEditable() to retrieve a mutable configuration object");
}
/**
* Deletes the configuration object.
*
* @return \Drupal\Core\Config\Config
* The configuration object.
*/
public function delete() {
throw new ImmutableConfigException("Can not delete immutable configuration {$this->getName()}. Use \\Drupal\\Core\\Config\\ConfigFactoryInterface::getEditable() to retrieve a mutable configuration object");
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CacheableDependencyTrait:: |
protected | property | Cache contexts. | |
CacheableDependencyTrait:: |
protected | property | Cache max-age. | |
CacheableDependencyTrait:: |
protected | property | Cache tags. | |
CacheableDependencyTrait:: |
protected | function | Sets cacheability; useful for value object constructors. | |
Config:: |
protected | property | An event dispatcher instance to use for configuration events. | |
Config:: |
protected | property | The current module overrides. | |
Config:: |
protected | property | The current runtime data. | |
Config:: |
protected | property | The current settings overrides. | |
Config:: |
public | function |
Gets data from this configuration object. Overrides ConfigBase:: |
|
Config:: |
public | function | Gets original data from this configuration object. | |
Config:: |
public | function | Gets the raw data without overrides. | |
Config:: |
public | function | Determines if overrides are applied to a key for this configuration object. | |
Config:: |
public | function |
Initializes a configuration object with pre-loaded data. Overrides StorableConfigBase:: |
|
Config:: |
protected | function | Resets the current data, so overrides are re-applied. | |
Config:: |
public | function |
Replaces the data of this configuration object. Overrides ConfigBase:: |
|
Config:: |
public | function | Sets module overrides for this configuration object. | |
Config:: |
protected | function | Sets the current data for this configuration object. | |
Config:: |
public | function | Sets settings.php overrides for this configuration object. | |
Config:: |
public | function | Constructs a configuration object. | |
ConfigBase:: |
protected | property | The data of the configuration object. | |
ConfigBase:: |
protected | property | The name of the configuration object. | |
ConfigBase:: |
protected | function | Casts any objects that implement MarkupInterface to string. | |
ConfigBase:: |
public | function |
The cache contexts associated with this object. Overrides CacheableDependencyTrait:: |
|
ConfigBase:: |
public | function |
The maximum age for which this object may be cached. Overrides CacheableDependencyTrait:: |
|
ConfigBase:: |
public | function |
The cache tags associated with this object. Overrides CacheableDependencyTrait:: |
1 |
ConfigBase:: |
public | function | Returns the name of this configuration object. | |
ConfigBase:: |
constant | The maximum length of a configuration object name. | ||
ConfigBase:: |
public | function | Merges data into a configuration object. | |
ConfigBase:: |
public | function | Sets the name of this configuration object. | |
ConfigBase:: |
protected | function | Validates all keys in a passed in config array structure. | |
ConfigBase:: |
public static | function | Validates the configuration object name. | |
DependencySerializationTrait:: |
protected | property | ||
DependencySerializationTrait:: |
protected | property | ||
DependencySerializationTrait:: |
public | function | 2 | |
DependencySerializationTrait:: |
public | function | 2 | |
ImmutableConfig:: |
public | function |
Unsets a value in this configuration object. Overrides Config:: |
|
ImmutableConfig:: |
public | function |
Deletes the configuration object. Overrides Config:: |
|
ImmutableConfig:: |
public | function |
Saves the configuration object. Overrides Config:: |
|
ImmutableConfig:: |
public | function |
Sets a value in this configuration object. Overrides Config:: |
|
RefinableCacheableDependencyTrait:: |
public | function | 1 | |
RefinableCacheableDependencyTrait:: |
public | function | ||
RefinableCacheableDependencyTrait:: |
public | function | ||
RefinableCacheableDependencyTrait:: |
public | function | ||
StorableConfigBase:: |
protected | property | Whether the configuration object is new or has been saved to the storage. | |
StorableConfigBase:: |
protected | property | The data of the configuration object. | |
StorableConfigBase:: |
protected | property | The config schema wrapper object for this configuration object. | |
StorableConfigBase:: |
protected | property | The storage used to load and save this configuration object. | |
StorableConfigBase:: |
protected | property | The typed config manager. | |
StorableConfigBase:: |
protected | function | Casts the value to correct data type using the configuration schema. | |
StorableConfigBase:: |
protected | function | Gets the schema wrapper for the whole configuration object. | |
StorableConfigBase:: |
public | function | Retrieves the storage used to load and save this configuration object. | |
StorableConfigBase:: |
public | function | Returns whether this configuration object is new. | |
StorableConfigBase:: |
protected | function | Validate the values are allowed data types. |