diff --git a/core/modules/field/modules/text/lib/Drupal/text/Tests/TextTranslationTest.php b/core/modules/field/modules/text/lib/Drupal/text/Tests/TextTranslationTest.php index c3c696a..8596785 100644 --- a/core/modules/field/modules/text/lib/Drupal/text/Tests/TextTranslationTest.php +++ b/core/modules/field/modules/text/lib/Drupal/text/Tests/TextTranslationTest.php @@ -51,7 +51,7 @@ class TextTranslationTest extends WebTestBase { $this->drupalPost('admin/config/regional/language/add', $edit, t('Add language')); // Set "Article" content type to use multilingual support with translation. - $edit = array('node_type_language_hidden' => FALSE, 'node_type_language_translation_enabled' => TRUE); + $edit = array('language_configuration[language_hidden]' => FALSE, 'node_type_language_translation_enabled' => TRUE); $this->drupalPost('admin/structure/types/manage/article', $edit, t('Save content type')); $this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Article')), t('Article content type has been updated.')); } diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleCommentLanguageTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleCommentLanguageTest.php index 6776e31..06935f7 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleCommentLanguageTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleCommentLanguageTest.php @@ -47,7 +47,7 @@ class LocaleCommentLanguageTest extends WebTestBase { $this->drupalPost('admin/config/regional/language/add', $edit, t('Add language')); // Set "Article" content type to use multilingual support. - $edit = array('node_type_language_hidden' => FALSE); + $edit = array('language_configuration[language_hidden]' => FALSE); $this->drupalPost('admin/structure/types/manage/article', $edit, t('Save content type')); // Enable content language negotiation UI. diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php index a41d68b..d30526a 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php @@ -88,7 +88,7 @@ class LocaleContentTest extends WebTestBase { $this->drupalGet('admin/structure/types/manage/page'); $this->assertText(t('Language settings'), t('Multilingual support fieldset present on content type configuration form.')); $edit = array( - 'node_type_language_hidden' => FALSE, + 'language_configuration[language_hidden]' => FALSE, ); $this->drupalPost('admin/structure/types/manage/page', $edit, t('Save content type')); $this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Basic page')), t('Basic page content type has been updated.')); @@ -156,7 +156,7 @@ class LocaleContentTest extends WebTestBase { // Set "Article" content type to use multilingual support. $this->drupalGet('admin/structure/types/manage/article'); $edit = array( - 'node_type_language_hidden' => FALSE, + 'language_configuration[language_hidden]' => FALSE, ); $this->drupalPost('admin/structure/types/manage/article', $edit, t('Save content type')); $this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Article')), t('Article content type has been updated.')); diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php index 00fb2b0..6dae2fe 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php @@ -62,7 +62,7 @@ class LocaleUninstallTest extends WebTestBase { $this->assertEqual(language(LANGUAGE_TYPE_INTERFACE)->langcode, $this->langcode, t('Current language: %lang', array('%lang' => language(LANGUAGE_TYPE_INTERFACE)->langcode))); // Enable multilingual workflow option for articles. - variable_set('node_type_language_hidden_article',FALSE); + language_save_default_configuration('node', 'article', array('language' => 'site_default', 'language_hidden' => FALSE)); // Change JavaScript translations directory. variable_set('locale_js_directory', 'js_translations'); // Build the JavaScript translation file for French. diff --git a/core/modules/node/content_types.inc b/core/modules/node/content_types.inc index d552451..989a436 100644 --- a/core/modules/node/content_types.inc +++ b/core/modules/node/content_types.inc @@ -257,6 +257,7 @@ function node_type_form($form, &$form_state, $type = NULL) { ); } } + $form['#submit'][] = 'node_type_form_submit'; return $form; } diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeFieldMultilingualTestCase.php b/core/modules/node/lib/Drupal/node/Tests/NodeFieldMultilingualTestCase.php index 88a64f7..6f7b9c6 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeFieldMultilingualTestCase.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeFieldMultilingualTestCase.php @@ -52,7 +52,7 @@ class NodeFieldMultilingualTestCase extends WebTestBase { // Set "Basic page" content type to use multilingual support. $edit = array( - 'node_type_language_hidden' => FALSE, + 'language_configuration[language_hidden]' => FALSE, ); $this->drupalPost('admin/structure/types/manage/page', $edit, t('Save content type')); $this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Basic page')), t('Basic page content type has been updated.')); diff --git a/core/modules/node/node.install b/core/modules/node/node.install index 5727129..c373862 100644 --- a/core/modules/node/node.install +++ b/core/modules/node/node.install @@ -465,11 +465,10 @@ function node_uninstall() { ->condition('name', 'node_options_' . $type) ->condition('name', 'node_submitted_' . $type) ->condition('name', 'node_permissions_' . $type) - ->condition('name', 'node_type_language_default_' . $type) - ->condition('name', 'node_type_language_hidden_' . $type) ->condition('name', 'node_type_language_translation_enabled_' . $type) ) ->execute(); + config('language.settings')->clear('language_default_configuration.node.' . $type); } // Delete node search ranking variables. @@ -601,6 +600,21 @@ function node_update_8004() { } /** + * Move the language default values to config. + */ +function node_update_8005() { + $types = db_query('SELECT type FROM {node_type}')->fetchCol(); + foreach ($types as $type) { + $language_default = variable_get('node_type_language_default_' . $type, NULL); + $language_hidden = variable_get('node_type_language_hidden_' . $type, NULL); + if (isset($language_default) || isset($language_hidden)) { + $values = array('language' => $language_default, 'language_hidden' => $language_hidden); + config('language.settings')->set('language_default_configuration.node.' . $type, $values); + } + } +} + +/** * @} End of "addtogroup updates-7.x-to-8.x" * The next series of updates should start at 9000. */ diff --git a/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php b/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php index 09518ab..563dbef 100644 --- a/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php +++ b/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php @@ -31,7 +31,7 @@ class PathLanguageTest extends PathTestBase { parent::setUp(); // Create and login user. - $this->web_user = $this->drupalCreateUser(array('edit any page content', 'create page content', 'administer url aliases', 'create url aliases', 'administer languages', 'translate content', 'access administration pages')); + $this->web_user = $this->drupalCreateUser(array('edit any page content', 'create page content', 'administer url aliases', 'create url aliases', 'administer languages', 'translate content', 'access administration pages', 'administer content types')); $this->drupalLogin($this->web_user); // Enable French language. @@ -50,7 +50,11 @@ class PathLanguageTest extends PathTestBase { */ function testAliasTranslation() { // Set 'page' content type to enable translation. - variable_set('node_type_language_hidden_page', FALSE); + $edit = array( + 'language_configuration[language_hidden]' => FALSE, + ); + $this->drupalPost('admin/structure/types/manage/page', $edit, t('Save content type')); + $this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Basic page')), 'Basic page content type has been updated.'); variable_set('node_type_language_translation_enabled_page', TRUE); $english_node = $this->drupalCreateNode(array('type' => 'page')); diff --git a/core/modules/poll/lib/Drupal/poll/Tests/PollTranslateTest.php b/core/modules/poll/lib/Drupal/poll/Tests/PollTranslateTest.php index 819b5f7..18dd55e 100644 --- a/core/modules/poll/lib/Drupal/poll/Tests/PollTranslateTest.php +++ b/core/modules/poll/lib/Drupal/poll/Tests/PollTranslateTest.php @@ -54,7 +54,7 @@ class PollTranslateTest extends PollTestBase { // Set "Poll" content type to use multilingual support with translation. $this->drupalGet('admin/structure/types/manage/poll'); - $edit = array('node_type_language_hidden' => FALSE, 'node_type_language_translation_enabled' => TRUE); + $edit = array('language_configuration[language_hidden]' => FALSE, 'node_type_language_translation_enabled' => TRUE); $this->drupalPost('admin/structure/types/manage/poll', $edit, t('Save content type')); $this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Poll')), t('Poll content type has been updated.')); diff --git a/core/modules/translation/lib/Drupal/translation/Tests/TranslationTest.php b/core/modules/translation/lib/Drupal/translation/Tests/TranslationTest.php index a409150..54af7d5 100644 --- a/core/modules/translation/lib/Drupal/translation/Tests/TranslationTest.php +++ b/core/modules/translation/lib/Drupal/translation/Tests/TranslationTest.php @@ -50,7 +50,7 @@ class TranslationTest extends WebTestBase { // Set "Basic page" content type to use multilingual support with // translation. $this->drupalGet('admin/structure/types/manage/page'); - $edit = array('node_type_language_hidden' => FALSE, 'node_type_language_translation_enabled' => TRUE); + $edit = array('language_configuration[language_hidden]' => FALSE, 'node_type_language_translation_enabled' => TRUE); $this->drupalPost('admin/structure/types/manage/page', $edit, t('Save content type')); $this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Basic page')), t('Basic page content type has been updated.')); @@ -229,7 +229,7 @@ class TranslationTest extends WebTestBase { // Disable translation support to check that the language switcher is left // untouched only for new nodes. $this->drupalLogin($this->admin_user); - $edit = array('node_type_language_hidden' => TRUE, 'node_type_language_translation_enabled' => FALSE); + $edit = array('language_configuration[language_hidden]' => TRUE, 'node_type_language_translation_enabled' => FALSE); $this->drupalPost('admin/structure/types/manage/page', $edit, t('Save content type')); $this->drupalLogin($this->translator); diff --git a/core/modules/translation/translation.module b/core/modules/translation/translation.module index 909117f..7916bec 100644 --- a/core/modules/translation/translation.module +++ b/core/modules/translation/translation.module @@ -136,7 +136,7 @@ function translation_form_node_type_form_alter(&$form, &$form_state) { * and language selector is not hidden, translation cannot be enabled. */ function translation_node_type_language_translation_enabled_validate($element, &$form_state, $form) { - if (language_is_locked($form_state['values']['node_type_language_default']) && $form_state['values']['node_type_language_hidden'] && $form_state['values']['node_type_language_translation_enabled']) { + if (language_is_locked($form_state['values']['language_configuration']['language']) && $form_state['values']['language_configuration']['language_hidden'] && $form_state['values']['node_type_language_translation_enabled']) { foreach (language_list(LANGUAGE_LOCKED) as $language) { $locked_languages[] = $language->name; }