From 4e847383cb118d0116a3d1c77ff4cdd2493e9827 Mon Sep 17 00:00:00 2001 From: Alex Pott <alex.a.pott@googlemail.com> Date: Fri, 25 Jul 2014 11:27:36 +0100 Subject: [PATCH] Issue #2300347 by vijaycs85, joshi.rohit100 | robertdbailey: Fixed Regression: checkbox to enable translation for users does not save. --- .../Tests/ContentTranslationSettingsTest.php | 19 ++++++++++++++++++- core/modules/user/src/AccountSettingsForm.php | 3 ++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/core/modules/content_translation/src/Tests/ContentTranslationSettingsTest.php b/core/modules/content_translation/src/Tests/ContentTranslationSettingsTest.php index 445fd5b49ca4..556e419dfead 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationSettingsTest.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationSettingsTest.php @@ -36,7 +36,7 @@ function setUp() { $this->container->get('comment.manager')->addDefaultField('node', 'article', 'comment_article', CommentItemInterface::OPEN, 'comment_article'); $this->container->get('comment.manager')->addDefaultField('node', 'page', 'comment_page'); - $admin_user = $this->drupalCreateUser(array('access administration pages', 'administer languages', 'administer content translation', 'administer content types', 'administer node fields', 'administer comment fields', 'administer comments', 'administer comment types')); + $admin_user = $this->drupalCreateUser(array('access administration pages', 'administer languages', 'administer content translation', 'administer content types', 'administer node fields', 'administer comment fields', 'administer comments', 'administer comment types', 'administer account settings')); $this->drupalLogin($admin_user); } @@ -183,6 +183,23 @@ function testSettingsUI() { } } + /** + * Tests the language settings checkbox on account settings page. + */ + function testAccountLanguageSettingsUI() { + // Make sure the checkbox is available and not checked by default. + $this->drupalGet('admin/config/people/accounts'); + $this->assertField('language[content_translation]'); + $this->assertNoFieldChecked('edit-language-content-translation'); + + $edit = array( + 'language[content_translation]' => TRUE, + ); + $this->drupalPostForm('admin/config/people/accounts', $edit, t('Save configuration')); + $this->drupalGet('admin/config/people/accounts'); + $this->assertFieldChecked('edit-language-content-translation'); + } + /** * Asserts that translatability has the expected value for the given bundle. * diff --git a/core/modules/user/src/AccountSettingsForm.php b/core/modules/user/src/AccountSettingsForm.php index 94c4baebd5c4..fa39ac253af4 100644 --- a/core/modules/user/src/AccountSettingsForm.php +++ b/core/modules/user/src/AccountSettingsForm.php @@ -59,6 +59,7 @@ public function getFormId() { * Implements \Drupal\Core\Form\FormInterface::buildForm(). */ public function buildForm(array $form, array &$form_state) { + $form = parent::buildForm($form, $form_state); $config = $this->config('user.settings'); $mail_config = $this->config('user.mail'); $site_config = $this->config('system.site'); @@ -401,7 +402,7 @@ public function buildForm(array $form, array &$form_state) { '#rows' => 3, ); - return parent::buildForm($form, $form_state); + return $form; } /** -- GitLab