diff --git a/core/lib/Drupal/Core/Config/ConfigFactory.php b/core/lib/Drupal/Core/Config/ConfigFactory.php index 8aeb301..fc025a2 100644 --- a/core/lib/Drupal/Core/Config/ConfigFactory.php +++ b/core/lib/Drupal/Core/Config/ConfigFactory.php @@ -117,6 +117,16 @@ public function enableOverrides() { } /** + * Returns whether overrides are enabled. + * + * @return bool + * Whether overrides are enabled. + */ + public function hasOverrides() { + return $this->useOverrides; + } + + /** * Returns a configuration object for a given name. * * @param string $name diff --git a/core/lib/Drupal/Core/EventSubscriber/ConfigGlobalOverrideSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/ConfigGlobalOverrideSubscriber.php deleted file mode 100644 index 02bf2cb..0000000 --- a/core/lib/Drupal/Core/EventSubscriber/ConfigGlobalOverrideSubscriber.php +++ /dev/null @@ -1,42 +0,0 @@ -getConfig(); - if (isset($conf[$config->getName()])) { - $config->setOverride($conf[$config->getName()]); - } - } - - /** - * Implements EventSubscriberInterface::getSubscribedEvents(). - */ - static function getSubscribedEvents() { - $events['config.init'][] = array('configInit', 30); - return $events; - } - -} diff --git a/core/modules/config_translation/lib/Drupal/config_translation/Form/ConfigTranslationFormBase.php b/core/modules/config_translation/lib/Drupal/config_translation/Form/ConfigTranslationFormBase.php index 9295b81..5e70f0f 100644 --- a/core/modules/config_translation/lib/Drupal/config_translation/Form/ConfigTranslationFormBase.php +++ b/core/modules/config_translation/lib/Drupal/config_translation/Form/ConfigTranslationFormBase.php @@ -166,9 +166,13 @@ public function buildForm(array $form, array &$form_state, Request $request = NU // Get base language configuration to display in the form before entering // into the language context for the form. This avoids repetitively going // in and out of the language context to get original values later. - $this->configFactory->disableOverrides(); + if ($hadOverrides = $this->configFactory->hasOverrides()) { + $this->configFactory->disableOverrides(); + } $this->baseConfigData = $this->mapper->getConfigData(); - $this->configFactory->enableOverrides(); + if ($hadOverrides) { + $this->configFactory->enableOverrides(); + } // Set the translation target language on the configuration factory. $original_language = $this->configFactory->getLanguage(); @@ -210,7 +214,9 @@ public function submitForm(array &$form, array &$form_state) { $form_values = $form_state['values']['config_names']; // For the form submission handling, use the raw data. - $this->configFactory->disableOverrides(); + if ($hadOverrides = $this->configFactory->hasOverrides()) { + $this->configFactory->disableOverrides(); + } foreach ($this->mapper->getConfigNames() as $name) { // Set configuration values based on form submission and source values. $base_config = $this->config($name); @@ -229,7 +235,9 @@ public function submitForm(array &$form, array &$form_state) { $translation_config->save(); } } - $this->configFactory->enableOverrides(); + if ($hadOverrides) { + $this->configFactory->enableOverrides(); + } $form_state['redirect_route'] = array( 'route_name' => $this->mapper->getOverviewRoute(),