Commit a2ae42b3 authored by Dries's avatar Dries

Issue #1853720 by vijaycs85, sun, Gábor Hojtsy: Fixed Hide language selection option is backwards.

parent 6a5461cb
...@@ -52,7 +52,7 @@ function setUp() { ...@@ -52,7 +52,7 @@ function setUp() {
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add language')); $this->drupalPost('admin/config/regional/language/add', $edit, t('Add language'));
// Set "Article" content type to use multilingual support. // Set "Article" content type to use multilingual support.
$edit = array('language_configuration[language_hidden]' => FALSE); $edit = array('language_configuration[language_show]' => TRUE);
$this->drupalPost('admin/structure/types/manage/article', $edit, t('Save content type')); $this->drupalPost('admin/structure/types/manage/article', $edit, t('Save content type'));
// Enable content language negotiation UI. // Enable content language negotiation UI.
......
...@@ -1023,7 +1023,7 @@ function language_content_settings_form(array $form, array $form_state, array $s ...@@ -1023,7 +1023,7 @@ function language_content_settings_form(array $form, array $form_state, array $s
// Check whether we have any custom setting. // Check whether we have any custom setting.
foreach (entity_get_bundles($entity_type) as $bundle) { foreach (entity_get_bundles($entity_type) as $bundle) {
$conf = language_get_default_configuration($entity_type, $bundle); $conf = language_get_default_configuration($entity_type, $bundle);
if (empty($conf['language_hidden']) || $conf['langcode'] != 'site_default') { if (!empty($conf['language_show']) || $conf['langcode'] != 'site_default') {
$default[$entity_type] = $entity_type; $default[$entity_type] = $entity_type;
} }
$language_configuration[$entity_type][$bundle] = $conf; $language_configuration[$entity_type][$bundle] = $conf;
......
...@@ -314,11 +314,10 @@ function language_configuration_element_process($element, &$form_state, &$form) ...@@ -314,11 +314,10 @@ function language_configuration_element_process($element, &$form_state, &$form)
'#default_value' => isset($element['#default_value']['langcode']) ? $element['#default_value']['langcode'] : NULL, '#default_value' => isset($element['#default_value']['langcode']) ? $element['#default_value']['langcode'] : NULL,
); );
$element['language_hidden'] = array( $element['language_show'] = array(
'#type' => 'checkbox', '#type' => 'checkbox',
'#title' => t('Hide language selection'), '#title' => t('Show language selector on create and edit pages'),
'#default_value' => isset($element['#default_value']['language_hidden']) ? $element['#default_value']['language_hidden'] : NULL, '#default_value' => isset($element['#default_value']['language_show']) ? $element['#default_value']['language_show'] : NULL,
'#description' => t('Language selector appears on create and edit pages.'),
); );
// Add the entity type and bundle information to the form if they are set. // Add the entity type and bundle information to the form if they are set.
...@@ -361,10 +360,10 @@ function language_configuration_element_submit(&$form, &$form_state) { ...@@ -361,10 +360,10 @@ function language_configuration_element_submit(&$form, &$form_state) {
* @param array $values * @param array $values
* An array holding the values to be saved having the following keys: * An array holding the values to be saved having the following keys:
* - langcode: the language code. * - langcode: the language code.
* - language_hidden: if the language element should be hidden or not. * - language_show: if the language element should be hidden or not.
*/ */
function language_save_default_configuration($entity_type, $bundle, $values = array()) { function language_save_default_configuration($entity_type, $bundle, $values = array()) {
config('language.settings')->set(language_get_default_configuration_settings_key($entity_type, $bundle), array('langcode' => $values['langcode'], 'language_hidden' => $values['language_hidden']))->save(); config('language.settings')->set(language_get_default_configuration_settings_key($entity_type, $bundle), array('langcode' => $values['langcode'], 'language_show' => $values['language_show']))->save();
} }
/** /**
...@@ -378,14 +377,14 @@ function language_save_default_configuration($entity_type, $bundle, $values = ar ...@@ -378,14 +377,14 @@ function language_save_default_configuration($entity_type, $bundle, $values = ar
* @return array * @return array
* An array with the following keys: * An array with the following keys:
* - langcode: the language code. * - langcode: the language code.
* - language_hidden: if the language element is hidden or not. * - language_show: if the language element is hidden or not.
*/ */
function language_get_default_configuration($entity_type, $bundle) { function language_get_default_configuration($entity_type, $bundle) {
$configuration = config('language.settings')->get(language_get_default_configuration_settings_key($entity_type, $bundle)); $configuration = config('language.settings')->get(language_get_default_configuration_settings_key($entity_type, $bundle));
if (is_null($configuration)) { if (is_null($configuration)) {
$configuration = array(); $configuration = array();
} }
$configuration += array('langcode' => 'site_default', 'language_hidden' => TRUE); $configuration += array('langcode' => 'site_default', 'language_show' => FALSE);
return $configuration; return $configuration;
} }
......
...@@ -36,30 +36,30 @@ public static function getInfo() { ...@@ -36,30 +36,30 @@ public static function getInfo() {
public function testLanguageConfigurationElement() { public function testLanguageConfigurationElement() {
$this->drupalGet('language-tests/language_configuration_element'); $this->drupalGet('language-tests/language_configuration_element');
$edit['lang_configuration[langcode]'] = 'current_interface'; $edit['lang_configuration[langcode]'] = 'current_interface';
$edit['lang_configuration[language_hidden]'] = TRUE; $edit['lang_configuration[language_show]'] = FALSE;
$this->drupalPost(NULL, $edit, 'Save'); $this->drupalPost(NULL, $edit, 'Save');
$lang_conf = language_get_default_configuration('some_custom_type', 'some_bundle'); $lang_conf = language_get_default_configuration('some_custom_type', 'some_bundle');
// Check that the settings have been saved. // Check that the settings have been saved.
$this->assertEqual($lang_conf['langcode'], 'current_interface'); $this->assertEqual($lang_conf['langcode'], 'current_interface');
$this->assertTrue($lang_conf['language_hidden']); $this->assertFalse($lang_conf['language_show']);
$this->drupalGet('language-tests/language_configuration_element'); $this->drupalGet('language-tests/language_configuration_element');
$this->assertOptionSelected('edit-lang-configuration-langcode', 'current_interface'); $this->assertOptionSelected('edit-lang-configuration-langcode', 'current_interface');
$this->assertFieldChecked('edit-lang-configuration-language-hidden'); $this->assertNoFieldChecked('edit-lang-configuration-language-show');
// Reload the page and save again. // Reload the page and save again.
$this->drupalGet('language-tests/language_configuration_element'); $this->drupalGet('language-tests/language_configuration_element');
$edit['lang_configuration[langcode]'] = 'authors_default'; $edit['lang_configuration[langcode]'] = 'authors_default';
$edit['lang_configuration[language_hidden]'] = FALSE; $edit['lang_configuration[language_show]'] = TRUE;
$this->drupalPost(NULL, $edit, 'Save'); $this->drupalPost(NULL, $edit, 'Save');
$lang_conf = language_get_default_configuration('some_custom_type', 'some_bundle'); $lang_conf = language_get_default_configuration('some_custom_type', 'some_bundle');
// Check that the settings have been saved. // Check that the settings have been saved.
$this->assertEqual($lang_conf['langcode'], 'authors_default'); $this->assertEqual($lang_conf['langcode'], 'authors_default');
$this->assertFalse($lang_conf['language_hidden']); $this->assertTrue($lang_conf['language_show']);
$this->drupalGet('language-tests/language_configuration_element'); $this->drupalGet('language-tests/language_configuration_element');
$this->assertOptionSelected('edit-lang-configuration-langcode', 'authors_default'); $this->assertOptionSelected('edit-lang-configuration-langcode', 'authors_default');
$this->assertNoFieldChecked('edit-lang-configuration-language-hidden'); $this->assertFieldChecked('edit-lang-configuration-language-show');
} }
/** /**
...@@ -76,12 +76,12 @@ public function testDefaultLangcode() { ...@@ -76,12 +76,12 @@ public function testDefaultLangcode() {
} }
// Fixed language. // Fixed language.
language_save_default_configuration('custom_type', 'custom_bundle', array('langcode' => 'bb', 'language_hidden' => FALSE)); language_save_default_configuration('custom_type', 'custom_bundle', array('langcode' => 'bb', 'language_show' => TRUE));
$langcode = language_get_default_langcode('custom_type', 'custom_bundle'); $langcode = language_get_default_langcode('custom_type', 'custom_bundle');
$this->assertEqual($langcode, 'bb'); $this->assertEqual($langcode, 'bb');
// Current interface. // Current interface.
language_save_default_configuration('custom_type', 'custom_bundle', array('langcode' => 'current_interface', 'language_hidden' => FALSE)); language_save_default_configuration('custom_type', 'custom_bundle', array('langcode' => 'current_interface', 'language_show' => TRUE));
$langcode = language_get_default_langcode('custom_type', 'custom_bundle'); $langcode = language_get_default_langcode('custom_type', 'custom_bundle');
$language_interface = language(LANGUAGE_TYPE_INTERFACE); $language_interface = language(LANGUAGE_TYPE_INTERFACE);
$this->assertEqual($langcode, $language_interface->langcode); $this->assertEqual($langcode, $language_interface->langcode);
...@@ -93,7 +93,7 @@ public function testDefaultLangcode() { ...@@ -93,7 +93,7 @@ public function testDefaultLangcode() {
$new_default = language_load('cc'); $new_default = language_load('cc');
$new_default->default = TRUE; $new_default->default = TRUE;
language_save($new_default); language_save($new_default);
language_save_default_configuration('custom_type', 'custom_bundle', array('langcode' => 'site_default', 'language_hidden' => FALSE)); language_save_default_configuration('custom_type', 'custom_bundle', array('langcode' => 'site_default', 'language_show' => TRUE));
$langcode = language_get_default_langcode('custom_type', 'custom_bundle'); $langcode = language_get_default_langcode('custom_type', 'custom_bundle');
$this->assertEqual($langcode, 'cc'); $this->assertEqual($langcode, 'cc');
...@@ -104,7 +104,7 @@ public function testDefaultLangcode() { ...@@ -104,7 +104,7 @@ public function testDefaultLangcode() {
$some_user->preferred_langcode = 'bb'; $some_user->preferred_langcode = 'bb';
$some_user->save(); $some_user->save();
$this->drupalLogin($some_user); $this->drupalLogin($some_user);
language_save_default_configuration('custom_type', 'some_bundle', array('langcode' => 'authors_default', 'language_hidden' => FALSE)); language_save_default_configuration('custom_type', 'some_bundle', array('langcode' => 'authors_default', 'language_show' => TRUE));
$this->drupalGet('language-tests/language_configuration_element_test'); $this->drupalGet('language-tests/language_configuration_element_test');
$this->assertOptionSelected('edit-langcode', 'bb'); $this->assertOptionSelected('edit-langcode', 'bb');
} }
...@@ -122,12 +122,12 @@ public function testNodeTypeUpdate() { ...@@ -122,12 +122,12 @@ public function testNodeTypeUpdate() {
$this->drupalLogin($admin_user); $this->drupalLogin($admin_user);
$edit = array( $edit = array(
'language_configuration[langcode]' => 'current_interface', 'language_configuration[langcode]' => 'current_interface',
'language_configuration[language_hidden]' => FALSE, 'language_configuration[language_show]' => TRUE,
); );
$this->drupalPost('admin/structure/types/manage/article', $edit, t('Save content type')); $this->drupalPost('admin/structure/types/manage/article', $edit, t('Save content type'));
// Check the language default configuration for the articles. // Check the language default configuration for the articles.
$configuration = language_get_default_configuration('node', 'article'); $configuration = language_get_default_configuration('node', 'article');
$this->assertEqual($configuration, array('langcode' => 'current_interface', 'language_hidden' => 0), 'The default language configuration has been saved on the Article content type.'); $this->assertEqual($configuration, array('langcode' => 'current_interface', 'language_show' => TRUE), 'The default language configuration has been saved on the Article content type.');
// Rename the article content type. // Rename the article content type.
$edit = array( $edit = array(
'type' => 'article_2' 'type' => 'article_2'
...@@ -135,6 +135,6 @@ public function testNodeTypeUpdate() { ...@@ -135,6 +135,6 @@ public function testNodeTypeUpdate() {
$this->drupalPost('admin/structure/types/manage/article', $edit, t('Save content type')); $this->drupalPost('admin/structure/types/manage/article', $edit, t('Save content type'));
// Check that we still have the settings for the new node type. // Check that we still have the settings for the new node type.
$configuration = language_get_default_configuration('node', 'article_2'); $configuration = language_get_default_configuration('node', 'article_2');
$this->assertEqual($configuration, array('langcode' => 'current_interface', 'language_hidden' => 0), 'The default language configuration has been kept on the new Article content type.'); $this->assertEqual($configuration, array('langcode' => 'current_interface', 'language_show' => TRUE), 'The default language configuration has been kept on the new Article content type.');
} }
} }
...@@ -89,7 +89,7 @@ function testContentTypeLanguageConfiguration() { ...@@ -89,7 +89,7 @@ function testContentTypeLanguageConfiguration() {
$this->drupalGet("admin/structure/types/manage/{$type2->type}"); $this->drupalGet("admin/structure/types/manage/{$type2->type}");
$this->assertText(t('Language settings'), 'Multilingual support widget present on content type configuration form.'); $this->assertText(t('Language settings'), 'Multilingual support widget present on content type configuration form.');
$edit = array( $edit = array(
'language_configuration[language_hidden]' => FALSE, 'language_configuration[language_show]' => TRUE,
); );
$this->drupalPost("admin/structure/types/manage/{$type2->type}", $edit, t('Save content type')); $this->drupalPost("admin/structure/types/manage/{$type2->type}", $edit, t('Save content type'));
$this->assertRaw(t('The content type %type has been updated.', array('%type' => $type2->name))); $this->assertRaw(t('The content type %type has been updated.', array('%type' => $type2->name)));
...@@ -159,7 +159,7 @@ function testContentTypeDirLang() { ...@@ -159,7 +159,7 @@ function testContentTypeDirLang() {
// Set the content type to use multilingual support. // Set the content type to use multilingual support.
$this->drupalGet("admin/structure/types/manage/{$type->type}"); $this->drupalGet("admin/structure/types/manage/{$type->type}");
$edit = array( $edit = array(
'language_configuration[language_hidden]' => FALSE, 'language_configuration[language_show]' => TRUE,
); );
$this->drupalPost("admin/structure/types/manage/{$type->type}", $edit, t('Save content type')); $this->drupalPost("admin/structure/types/manage/{$type->type}", $edit, t('Save content type'));
$this->assertRaw(t('The content type %type has been updated.', array('%type' => $type->name))); $this->assertRaw(t('The content type %type has been updated.', array('%type' => $type->name)));
......
...@@ -63,7 +63,7 @@ function testUninstallProcess() { ...@@ -63,7 +63,7 @@ function testUninstallProcess() {
$this->assertEqual(language(LANGUAGE_TYPE_INTERFACE)->langcode, $this->langcode, t('Current language: %lang', array('%lang' => language(LANGUAGE_TYPE_INTERFACE)->langcode))); $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. // Enable multilingual workflow option for articles.
language_save_default_configuration('node', 'article', array('langcode' => 'site_default', 'language_hidden' => FALSE)); language_save_default_configuration('node', 'article', array('langcode' => 'site_default', 'language_show' => TRUE));
// Change JavaScript translations directory. // Change JavaScript translations directory.
variable_set('locale_js_directory', 'js_translations'); variable_set('locale_js_directory', 'js_translations');
// Build the JavaScript translation file for French. // Build the JavaScript translation file for French.
......
...@@ -106,7 +106,7 @@ public function form(array $form, array &$form_state, EntityInterface $node) { ...@@ -106,7 +106,7 @@ public function form(array $form, array &$form_state, EntityInterface $node) {
'#type' => 'language_select', '#type' => 'language_select',
'#default_value' => $node->langcode, '#default_value' => $node->langcode,
'#languages' => LANGUAGE_ALL, '#languages' => LANGUAGE_ALL,
'#access' => isset($language_configuration['language_hidden']) && !$language_configuration['language_hidden'], '#access' => isset($language_configuration['language_show']) && $language_configuration['language_show'],
); );
$form['additional_settings'] = array( $form['additional_settings'] = array(
......
...@@ -53,7 +53,7 @@ function setUp() { ...@@ -53,7 +53,7 @@ function setUp() {
// Set "Basic page" content type to use multilingual support. // Set "Basic page" content type to use multilingual support.
$edit = array( $edit = array(
'language_configuration[language_hidden]' => FALSE, 'language_configuration[language_show]' => TRUE,
); );
$this->drupalPost('admin/structure/types/manage/page', $edit, t('Save content type')); $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.'); $this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Basic page')), 'Basic page content type has been updated.');
......
...@@ -42,8 +42,8 @@ function setUp() { ...@@ -42,8 +42,8 @@ function setUp() {
*/ */
function testNodeTypeInitialLanguageDefaults() { function testNodeTypeInitialLanguageDefaults() {
$this->drupalGet('admin/structure/types/manage/article'); $this->drupalGet('admin/structure/types/manage/article');
$this->assertOptionSelected('edit-language-configuration-langcode', 'site_default', 'The default inital language is the site default.'); $this->assertOptionSelected('edit-language-configuration-langcode', 'site_default', 'The default initial language is the site default.');
$this->assertFieldChecked('edit-language-configuration-language-hidden', 'Language selector is hidden by default.'); $this->assertNoFieldChecked('edit-language-configuration-language-show', 'Language selector is hidden by default.');
// Tests if the language field cannot be rearranged on the manage fields tab. // Tests if the language field cannot be rearranged on the manage fields tab.
$this->drupalGet('admin/structure/types/manage/article/fields'); $this->drupalGet('admin/structure/types/manage/article/fields');
...@@ -66,12 +66,12 @@ function testNodeTypeInitialLanguageDefaults() { ...@@ -66,12 +66,12 @@ function testNodeTypeInitialLanguageDefaults() {
// Tests the initial language after changing the site default language. // Tests the initial language after changing the site default language.
// First unhide the language selector. // First unhide the language selector.
$edit = array( $edit = array(
'language_configuration[language_hidden]' => FALSE, 'language_configuration[language_show]' => TRUE,
); );
$this->drupalPost('admin/structure/types/manage/article', $edit, t('Save content type')); $this->drupalPost('admin/structure/types/manage/article', $edit, t('Save content type'));
$this->drupalGet('node/add/article'); $this->drupalGet('node/add/article');
$this->assertField('langcode', 'Language is selectable on node add/edit page when language not hidden.'); $this->assertField('langcode', 'Language is selectable on node add/edit page when language not hidden.');
$this->assertOptionSelected('edit-langcode', 'hu', 'The inital language is the site default on the node add page after the site default language is changed.'); $this->assertOptionSelected('edit-langcode', 'hu', 'The initial language is the site default on the node add page after the site default language is changed.');
// Tests if the language field can be rearranged on the manage fields tab. // Tests if the language field can be rearranged on the manage fields tab.
$this->drupalGet('admin/structure/types/manage/article/fields'); $this->drupalGet('admin/structure/types/manage/article/fields');
...@@ -91,7 +91,7 @@ function testNodeTypeInitialLanguageDefaults() { ...@@ -91,7 +91,7 @@ function testNodeTypeInitialLanguageDefaults() {
); );
$this->drupalPost('admin/structure/types/manage/article', $edit, t('Save content type')); $this->drupalPost('admin/structure/types/manage/article', $edit, t('Save content type'));
$this->drupalGet('node/add/article'); $this->drupalGet('node/add/article');
$this->assertOptionSelected('edit-langcode', 'en', 'The inital language is the defined language.'); $this->assertOptionSelected('edit-langcode', 'en', 'The initial language is the defined language.');
} }
/** /**
......
...@@ -509,14 +509,14 @@ function node_update_8003() { ...@@ -509,14 +509,14 @@ function node_update_8003() {
update_variable_set('node_type_language_default_' . $type, LANGUAGE_NOT_SPECIFIED); update_variable_set('node_type_language_default_' . $type, LANGUAGE_NOT_SPECIFIED);
$node_type_language = update_variable_get('node_type_language_' . $type, 0); $node_type_language = update_variable_get('node_type_language_' . $type, 0);
if ($node_type_language == 0) { if ($node_type_language == 0) {
update_variable_set('node_type_language_hidden_' . $type, TRUE); update_variable_set('node_type_language_show_' . $type, FALSE);
} }
if ($node_type_language == 2) { if ($node_type_language == 2) {
// Translation was enabled, so enable it again and // Translation was enabled, so enable it again and
// unhide the language selector. Because if language is // unhide the language selector. Because if language is
// LANGUAGE_NOT_SPECIFIED and the selector hidden, translation // LANGUAGE_NOT_SPECIFIED and the selector hidden, translation
// cannot be enabled. // cannot be enabled.
update_variable_set('node_type_language_hidden_' . $type, FALSE); update_variable_set('node_type_language_show_' . $type, TRUE);
update_variable_set('node_type_language_translation_enabled_' . $type, TRUE); update_variable_set('node_type_language_translation_enabled_' . $type, TRUE);
} }
update_variable_del('node_type_language_' . $type); update_variable_del('node_type_language_' . $type);
...@@ -627,9 +627,9 @@ function node_update_8007() { ...@@ -627,9 +627,9 @@ function node_update_8007() {
$types = db_query('SELECT type FROM {node_type}')->fetchCol(); $types = db_query('SELECT type FROM {node_type}')->fetchCol();
foreach ($types as $type) { foreach ($types as $type) {
$language_default = update_variable_get('node_type_language_default_' . $type, NULL); $language_default = update_variable_get('node_type_language_default_' . $type, NULL);
$language_hidden = update_variable_get('node_type_language_hidden_' . $type, NULL); $language_show = update_variable_get('node_type_language_show_' . $type, NULL);
if (isset($language_default) || isset($language_hidden)) { if (isset($language_default) || isset($language_show)) {
$values = array('langcode' => $language_default, 'language_hidden' => $language_hidden); $values = array('langcode' => $language_default, 'language_show' => $language_show);
config('language.settings')->set('node.' . $type . '.language.default_configuration', $values)->save(); config('language.settings')->set('node.' . $type . '.language.default_configuration', $values)->save();
} }
} }
......
...@@ -609,7 +609,7 @@ function node_field_extra_fields() { ...@@ -609,7 +609,7 @@ function node_field_extra_fields() {
// node/add form. // node/add form.
if ($module_language_enabled) { if ($module_language_enabled) {
$configuration = language_get_default_configuration('node', $bundle->type); $configuration = language_get_default_configuration('node', $bundle->type);
if (!$configuration['language_hidden']) { if ($configuration['language_show']) {
$extra['node'][$bundle->type]['form']['language'] = array( $extra['node'][$bundle->type]['form']['language'] = array(
'label' => t('Language'), 'label' => t('Language'),
'description' => $description, 'description' => $description,
......
...@@ -51,7 +51,7 @@ function setUp() { ...@@ -51,7 +51,7 @@ function setUp() {
function testAliasTranslation() { function testAliasTranslation() {
// Set 'page' content type to enable translation. // Set 'page' content type to enable translation.
$edit = array( $edit = array(
'language_configuration[language_hidden]' => FALSE, 'language_configuration[language_show]' => TRUE,
); );
$this->drupalPost('admin/structure/types/manage/page', $edit, t('Save content type')); $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.'); $this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Basic page')), 'Basic page content type has been updated.');
......
...@@ -54,7 +54,7 @@ function testPollTranslate() { ...@@ -54,7 +54,7 @@ function testPollTranslate() {
// Set "Poll" content type to use multilingual support with translation. // Set "Poll" content type to use multilingual support with translation.
$this->drupalGet('admin/structure/types/manage/poll'); $this->drupalGet('admin/structure/types/manage/poll');
$edit = array('language_configuration[language_hidden]' => FALSE, 'node_type_language_translation_enabled' => TRUE); $edit = array('language_configuration[language_show]' => TRUE, 'node_type_language_translation_enabled' => TRUE);
$this->drupalPost('admin/structure/types/manage/poll', $edit, t('Save content type')); $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')), 'Poll content type has been updated.'); $this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Poll')), 'Poll content type has been updated.');
......
...@@ -86,7 +86,7 @@ function testEntityFormLanguage() { ...@@ -86,7 +86,7 @@ function testEntityFormLanguage() {
// Enable language selector. // Enable language selector.
$this->drupalGet('admin/structure/types/manage/page'); $this->drupalGet('admin/structure/types/manage/page');
$edit = array('language_configuration[language_hidden]' => FALSE, 'language_configuration[langcode]' => LANGUAGE_NOT_SPECIFIED); $edit = array('language_configuration[language_show]' => TRUE, 'language_configuration[langcode]' => LANGUAGE_NOT_SPECIFIED);
$this->drupalPost('admin/structure/types/manage/page', $edit, t('Save content type')); $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.'); $this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Basic page')), 'Basic page content type has been updated.');
......
...@@ -47,7 +47,7 @@ public function form(array $form, array &$form_state, EntityInterface $term) { ...@@ -47,7 +47,7 @@ public function form(array $form, array &$form_state, EntityInterface $term) {
'#title' => t('Language'), '#title' => t('Language'),
'#languages' => LANGUAGE_ALL, '#languages' => LANGUAGE_ALL,
'#default_value' => $term->langcode, '#default_value' => $term->langcode,
'#access' => !is_null($language_configuration['language_hidden']) && !$language_configuration['language_hidden'], '#access' => !is_null($language_configuration['language_show']) && $language_configuration['language_show'],
); );
$form['relations'] = array( $form['relations'] = array(
......
...@@ -47,7 +47,7 @@ function setUp() { ...@@ -47,7 +47,7 @@ function setUp() {
function testTermLanguage() { function testTermLanguage() {
// Configure the vocabulary to not hide the language selector. // Configure the vocabulary to not hide the language selector.
$edit = array( $edit = array(
'default_language[language_hidden]' => FALSE, 'default_language[language_show]' => TRUE,
); );
$this->drupalPost('admin/structure/taxonomy/' . $this->vocabulary->id() . '/edit', $edit, t('Save')); $this->drupalPost('admin/structure/taxonomy/' . $this->vocabulary->id() . '/edit', $edit, t('Save'));
...@@ -83,7 +83,7 @@ function testDefaultTermLanguage() { ...@@ -83,7 +83,7 @@ function testDefaultTermLanguage() {
// default language of the terms fixed. // default language of the terms fixed.
$edit = array( $edit = array(
'default_language[langcode]' => 'bb', 'default_language[langcode]' => 'bb',
'default_language[language_hidden]' => FALSE, 'default_language[language_show]' => TRUE,
); );
$this->drupalPost('admin/structure/taxonomy/' . $this->vocabulary->id() . '/edit', $edit, t('Save')); $this->drupalPost('admin/structure/taxonomy/' . $this->vocabulary->id() . '/edit', $edit, t('Save'));
$this->drupalGet('admin/structure/taxonomy/' . $this->vocabulary->id() . '/add'); $this->drupalGet('admin/structure/taxonomy/' . $this->vocabulary->id() . '/add');
...@@ -92,7 +92,7 @@ function testDefaultTermLanguage() { ...@@ -92,7 +92,7 @@ function testDefaultTermLanguage() {
// Make the default language of the terms to be the current interface. // Make the default language of the terms to be the current interface.
$edit = array( $edit = array(
'default_language[langcode]' => 'current_interface', 'default_language[langcode]' => 'current_interface',
'default_language[language_hidden]' => FALSE, 'default_language[language_show]' => TRUE,
); );
$this->drupalPost('admin/structure/taxonomy/' . $this->vocabulary->id() . '/edit', $edit, t('Save')); $this->drupalPost('admin/structure/taxonomy/' . $this->vocabulary->id() . '/edit', $edit, t('Save'));
$this->drupalGet('aa/admin/structure/taxonomy/' . $this->vocabulary->id() . '/add'); $this->drupalGet('aa/admin/structure/taxonomy/' . $this->vocabulary->id() . '/add');
...@@ -110,7 +110,7 @@ function testDefaultTermLanguage() { ...@@ -110,7 +110,7 @@ function testDefaultTermLanguage() {
language_save($new_default); language_save($new_default);
$edit = array( $edit = array(
'default_language[langcode]' => 'site_default', 'default_language[langcode]' => 'site_default',
'default_language[language_hidden]' => FALSE, 'default_language[language_show]' => TRUE,
); );
$this->drupalPost('admin/structure/taxonomy/' . $this->vocabulary->id() . '/edit', $edit, t('Save')); $this->drupalPost('admin/structure/taxonomy/' . $this->vocabulary->id() . '/edit', $edit, t('Save'));
$this->drupalGet('admin/structure/taxonomy/' . $this->vocabulary->id() . '/add'); $this->drupalGet('admin/structure/taxonomy/' . $this->vocabulary->id() . '/add');
......
...@@ -86,7 +86,7 @@ function testVocabularyDefaultLanguageForTerms() { ...@@ -86,7 +86,7 @@ function testVocabularyDefaultLanguageForTerms() {
'name' => $this->randomName(), 'name' => $this->randomName(),
'vid' => drupal_strtolower($this->randomName()), 'vid' => drupal_strtolower($this->randomName()),
'default_language[langcode]' => 'bb', 'default_language[langcode]' => 'bb',
'default_language[language_hidden]' => FALSE, 'default_language[language_show]' => TRUE,
); );
$vid = $edit['vid']; $vid = $edit['vid'];
$this->drupalPost('admin/structure/taxonomy/add', $edit, t('Save')); $this->drupalPost('admin/structure/taxonomy/add', $edit, t('Save'));
...@@ -98,39 +98,39 @@ function testVocabularyDefaultLanguageForTerms() { ...@@ -98,39 +98,39 @@ function testVocabularyDefaultLanguageForTerms() {
// Check that the language settings were saved. // Check that the language settings were saved.
$language_settings = language_get_default_configuration('taxonomy_term', $edit['vid']); $language_settings = language_get_default_configuration('taxonomy_term', $edit['vid']);
$this->assertEqual($language_settings['langcode'], 'bb'); $this->assertEqual($language_settings['langcode'], 'bb');
$this->assertEqual($language_settings['language_hidden'], FALSE); $this->assertEqual($language_settings['language_show'], TRUE);
// Check that the correct options are selected in the interface. // Check that the correct options are selected in the interface.
$this->assertOptionSelected('edit-default-language-langcode', 'bb', 'The correct default language for the terms of this vocabulary is selected.'); $this->assertOptionSelected('edit-default-language-langcode', 'bb', 'The correct default language for the terms of this vocabulary is selected.');
$this->assertNoFieldChecked('edit-default-language-language-hidden', 'Hide language selection option is not checked.'); $this->assertFieldChecked('edit-default-language-language-show', 'Show language selection option is checked.');
// Edit the vocabulary and check that the new settings are updated. // Edit the vocabulary and check that the new settings are updated.
$edit = array( $edit = array(
'default_language[langcode]' => 'aa', 'default_language[langcode]' => 'aa',
'default_language[language_hidden]' => TRUE, 'default_language[language_show]' => FALSE,
); );
$this->drupalPost('admin/structure/taxonomy/' . $vid . '/edit', $edit, t('Save')); $this->drupalPost('admin/structure/taxonomy/' . $vid . '/edit', $edit, t('Save'));
// And check again the settings and also the interface. // And check again the settings and also the interface.
$language_settings = language_get_default_configuration('taxonomy_term', $vid); $language_settings = language_get_default_configuration('taxonomy_term', $vid);