diff --git a/core/lib/Drupal/Core/Config/ConfigFactory.php b/core/lib/Drupal/Core/Config/ConfigFactory.php index 51ec3a8..cf3688d 100644 --- a/core/lib/Drupal/Core/Config/ConfigFactory.php +++ b/core/lib/Drupal/Core/Config/ConfigFactory.php @@ -113,9 +113,7 @@ public function getOverrideState() { */ public function getEditable($name, $override_free = TRUE) { $old_state = $this->getOverrideState(); - if ($override_free) { - $this->setOverrideState(FALSE); - } + $this->setOverrideState(FALSE); $config = $this->doGet($name, FALSE); $this->setOverrideState($old_state); return $config; diff --git a/core/lib/Drupal/Core/Config/ConfigFactoryInterface.php b/core/lib/Drupal/Core/Config/ConfigFactoryInterface.php index 552cde4..c58521e 100644 --- a/core/lib/Drupal/Core/Config/ConfigFactoryInterface.php +++ b/core/lib/Drupal/Core/Config/ConfigFactoryInterface.php @@ -56,18 +56,16 @@ public function get($name); /** * Returns an mutable configuration object for a given name. * - * Should not be used for config that will have runtime effects. + * Should not be used for config that will have runtime effects. Therefore it + * is always loaded override free. * * @param string $name * The name of the configuration object to construct. - * @param bool $override_free - * (optional) If set to TRUE guarantees that the configuration is override - * free. Defaults to TRUE. * * @return \Drupal\Core\Config\Config * A configuration object. */ - public function getEditable($name, $override_free = TRUE); + public function getEditable($name); /** * Returns a list of configuration objects for the given names. diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php index a500937..a686839 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php @@ -200,7 +200,7 @@ protected function doCreate(array $values) { */ protected function doDelete($entities) { foreach ($entities as $entity) { - $this->configFactory->getEditable($this->getPrefix() . $entity->id(), FALSE)->delete(); + $this->configFactory->getEditable($this->getPrefix() . $entity->id())->delete(); } } @@ -245,7 +245,7 @@ protected function doSave($id, EntityInterface $entity) { // - All instances of the object need to be renamed. $this->configFactory->rename($prefix . $id, $config_name); } - $config = $this->configFactory->getEditable($config_name, FALSE); + $config = $this->configFactory->getEditable($config_name); // Retrieve the desired properties and set them in config. $config->setData($this->mapToStorageRecord($entity)); diff --git a/core/modules/config/src/Tests/ConfigOverrideTest.php b/core/modules/config/src/Tests/ConfigOverrideTest.php index 024db81..7508896 100644 --- a/core/modules/config/src/Tests/ConfigOverrideTest.php +++ b/core/modules/config/src/Tests/ConfigOverrideTest.php @@ -55,14 +55,22 @@ function testConfOverride() { $this->assertFalse(isset($data['baz'])); $this->assertIdentical($data['404'], $expected_original_data['404']); - // Get the mutable configuration object with overrides. - $config = \Drupal::configFactory()->getEditable('config_test.system', FALSE); + // Get the configuration object with overrides. + $config = \Drupal::configFactory()->get('config_test.system'); // Verify that it contains the overridden data from $config. $this->assertIdentical($config->get('foo'), $overrides['config_test.system']['foo']); $this->assertIdentical($config->get('baz'), $overrides['config_test.system']['baz']); $this->assertIdentical($config->get('404'), $overrides['config_test.system']['404']); + // Get the configuration object which does not have overrides. + $config = \Drupal::configFactory()->getEditable('config_test.system'); + + // Verify that it does not contains the overridden data from $config. + $this->assertIdentical($config->get('foo'), $expected_original_data['foo']); + $this->assertIdentical($config->get('baz'), NULL); + $this->assertIdentical($config->get('404'), $expected_original_data['404']); + // Set the value for 'baz' (on the original data). $expected_original_data['baz'] = 'original baz'; $config->set('baz', $expected_original_data['baz']); @@ -71,11 +79,6 @@ function testConfOverride() { $expected_original_data['404'] = 'original 404'; $config->set('404', $expected_original_data['404']); - // Verify that it still contains the overridden data from $config. - $this->assertIdentical($config->get('foo'), $overrides['config_test.system']['foo']); - $this->assertIdentical($config->get('baz'), $overrides['config_test.system']['baz']); - $this->assertIdentical($config->get('404'), $overrides['config_test.system']['404']); - // Save the configuration object (having overrides applied). $config->save(); @@ -85,6 +88,11 @@ function testConfOverride() { $this->assertIdentical($config->get('baz'), $overrides['config_test.system']['baz']); $this->assertIdentical($config->get('404'), $overrides['config_test.system']['404']); + // Verify that raw config data has changed. + $this->assertIdentical($config->getOriginal('foo', FALSE), $expected_original_data['foo']); + $this->assertIdentical($config->getOriginal('baz', FALSE), $expected_original_data['baz']); + $this->assertIdentical($config->getOriginal('404', FALSE), $expected_original_data['404']); + // Write file to staging. $staging = $this->container->get('config.storage.staging'); $expected_new_data = array( @@ -118,7 +126,7 @@ function testConfOverride() { $this->assertIdentical($config->get('key'), 'override'); $old_state = \Drupal::configFactory()->getOverrideState(); \Drupal::configFactory()->setOverrideState(FALSE); - $config_raw = \Drupal::configFactory()->getEditable('config_test.new', FALSE); + $config_raw = \Drupal::configFactory()->getEditable('config_test.new'); $this->assertIdentical($config_raw->get('key'), NULL); $config_raw ->set('key', 'raw') diff --git a/core/modules/language/src/Form/ContentLanguageSettingsForm.php b/core/modules/language/src/Form/ContentLanguageSettingsForm.php index a7151fe..26e7ef5 100644 --- a/core/modules/language/src/Form/ContentLanguageSettingsForm.php +++ b/core/modules/language/src/Form/ContentLanguageSettingsForm.php @@ -130,7 +130,15 @@ public function buildForm(array $form, FormStateInterface $form_state) { } } - $form = parent::buildForm($form, $form_state); + $form['actions']['#type'] = 'actions'; + $form['actions']['submit'] = array( + '#type' => 'submit', + '#value' => $this->t('Save configuration'), + '#button_type' => 'primary', + ); + + // By default, render the form using theme_system_config_form(). + $form['#theme'] = 'system_config_form'; return $form; }