diff --git a/core/modules/content_translation/content_translation.module b/core/modules/content_translation/content_translation.module index 8449c9db5ba7c5ea332e2c0eb73cd01b6ef713fe..27641895a66a206d75c5dc8f1d8b0805cbf38ed4 100644 --- a/core/modules/content_translation/content_translation.module +++ b/core/modules/content_translation/content_translation.module @@ -471,7 +471,14 @@ function content_translation_language_configuration_element_process(array $eleme ); $submit_name = isset($form['actions']['save_continue']) ? 'save_continue' : 'submit'; - $form['actions'][$submit_name]['#submit'][] = 'content_translation_language_configuration_element_submit'; + // Only add the submit handler on the submit button if the #submit property + // is already available, otherwise this breaks the form submit function. + if (isset($form['actions'][$submit_name]['#submit'])) { + $form['actions'][$submit_name]['#submit'][] = 'content_translation_language_configuration_element_submit'; + } + else { + $form['#submit'][] = 'content_translation_language_configuration_element_submit'; + } } return $element; } diff --git a/core/modules/content_translation/src/Tests/ContentTranslationSettingsTest.php b/core/modules/content_translation/src/Tests/ContentTranslationSettingsTest.php index c928bacc5c9b76dfa44497c1989427857e0dd896..f1ddd4ab76bdb2fe11228b5b29b9dc03aaee05a3 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationSettingsTest.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationSettingsTest.php @@ -217,6 +217,11 @@ function testAccountLanguageSettingsUI() { $this->drupalPostForm('admin/config/people/accounts', $edit, t('Save configuration')); $this->drupalGet('admin/config/people/accounts'); $this->assertFieldChecked('edit-language-content-translation'); + + // Make sure account settings can be saved. + $this->drupalPostForm('admin/config/people/accounts', array('anonymous' => 'Save me please!'), 'Save configuration'); + $this->assertFieldByName('anonymous', 'Save me please!', 'Anonymous name has been changed.'); + $this->assertText('The configuration options have been saved.'); } /**