class ImmutableConfig in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Config/ImmutableConfig.php \Drupal\Core\Config\ImmutableConfig
- 9 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");
}
}