comparison core/lib/Drupal/Core/Config/ImmutableConfig.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3 namespace Drupal\Core\Config;
4
5 /**
6 * Defines the immutable configuration object.
7 *
8 * Encapsulates all capabilities needed for runtime configuration handling
9 * except being able to change the configuration.
10 *
11 * If you need to be able to change configuration use
12 * \Drupal\Core\Form\ConfigFormBaseTrait or
13 * \Drupal\Core\Config\ConfigFactoryInterface::getEditable().
14 *
15 * @see \Drupal\Core\Form\ConfigFormBaseTrait
16 * @see \Drupal\Core\Config\ConfigFactoryInterface::getEditable()
17 * @see \Drupal\Core\Config\ConfigFactoryInterface::get()
18 *
19 * @ingroup config_api
20 */
21 class ImmutableConfig extends Config {
22
23 /**
24 * {@inheritdoc}
25 */
26 public function set($key, $value) {
27 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");
28 }
29
30 /**
31 * {@inheritdoc}
32 */
33 public function clear($key) {
34 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");
35 }
36
37 /**
38 * {@inheritdoc}
39 */
40 public function save($has_trusted_data = FALSE) {
41 throw new ImmutableConfigException("Can not save immutable configuration {$this->getName()}. Use \\Drupal\\Core\\Config\\ConfigFactoryInterface::getEditable() to retrieve a mutable configuration object");
42 }
43
44 /**
45 * Deletes the configuration object.
46 *
47 * @return \Drupal\Core\Config\Config
48 * The configuration object.
49 */
50 public function delete() {
51 throw new ImmutableConfigException("Can not delete immutable configuration {$this->getName()}. Use \\Drupal\\Core\\Config\\ConfigFactoryInterface::getEditable() to retrieve a mutable configuration object");
52 }
53
54 }