diff --git a/core/lib/Drupal/Core/Config/Config.php b/core/lib/Drupal/Core/Config/Config.php index 83366b1..ccd38ab 100644 --- a/core/lib/Drupal/Core/Config/Config.php +++ b/core/lib/Drupal/Core/Config/Config.php @@ -275,12 +275,14 @@ protected function replaceData(array $data) { * * @param array $data * The overridden values of the configuration data. + * @param bool $force + * Force the override (used for global overrides). * * @return \Drupal\Core\Config\Config * The configuration object. */ - public function setOverride(array $data) { - $this->context->setOverrides($this->getName(), $data); + public function setOverride(array $data, $force = FALSE) { + $this->context->setOverrides($this->getName(), $data, $force); $this->resetOverriddenData(); return $this; } diff --git a/core/lib/Drupal/Core/Config/Context/ConfigContext.php b/core/lib/Drupal/Core/Config/Context/ConfigContext.php index 128165b..3e6f2ca 100644 --- a/core/lib/Drupal/Core/Config/Context/ConfigContext.php +++ b/core/lib/Drupal/Core/Config/Context/ConfigContext.php @@ -119,7 +119,7 @@ public function notify($config_event_name, Config $config = NULL) { /** * Implements \Drupal\Core\Config\Context\ContextInterface::setOverride(). */ - public function setOverrides($config_name, $data) { + public function setOverrides($config_name, $data, $force = FALSE) { if (!isset($this->overrides[$config_name])) { $this->overrides[$config_name] = $data; } diff --git a/core/lib/Drupal/Core/Config/Context/ContextInterface.php b/core/lib/Drupal/Core/Config/Context/ContextInterface.php index e37d2d0..faf670a 100644 --- a/core/lib/Drupal/Core/Config/Context/ContextInterface.php +++ b/core/lib/Drupal/Core/Config/Context/ContextInterface.php @@ -84,8 +84,10 @@ public function notify($config_event_name, Config $config = NULL); * Configuration name. * @param array data * The override data. + * @param bool $force + * Force the override (used for global overrides). */ - public function setOverrides($config_name, $data); + public function setOverrides($config_name, $data, $force = FALSE); /** * Gets the override data for a configuration object. diff --git a/core/lib/Drupal/Core/Config/Context/FreeConfigContext.php b/core/lib/Drupal/Core/Config/Context/FreeConfigContext.php index 4307f97..a140365 100644 --- a/core/lib/Drupal/Core/Config/Context/FreeConfigContext.php +++ b/core/lib/Drupal/Core/Config/Context/FreeConfigContext.php @@ -23,7 +23,7 @@ public function getOverrides($config_name) { /** * Implements \Drupal\Core\Config\Context\ContextInterface::setOverride(). */ - public function setOverrides($config_name, $data) { + public function setOverrides($config_name, $data, $force = FALSE) { // Do nothing as this is override free. } diff --git a/core/lib/Drupal/Core/Config/Context/OnlyForcedConfigContext.php b/core/lib/Drupal/Core/Config/Context/OnlyForcedConfigContext.php new file mode 100644 index 0000000..e3556d5 --- /dev/null +++ b/core/lib/Drupal/Core/Config/Context/OnlyForcedConfigContext.php @@ -0,0 +1,25 @@ +getConfig(); if (isset($conf[$config->getName()])) { - $config->setOverride($conf[$config->getName()]); + $config->setOverride($conf[$config->getName()], TRUE); } }