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() {
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add language'));
// 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'));
// Enable content language negotiation UI.
......
......@@ -1023,7 +1023,7 @@ function language_content_settings_form(array $form, array $form_state, array $s
// Check whether we have any custom setting.
foreach (entity_get_bundles($entity_type) as $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;
}
$language_configuration[$entity_type][$bundle] = $conf;
......
......@@ -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,
);
$element['language_hidden'] = array(
$element['language_show'] = array(
'#type' => 'checkbox',
'#title' => t('Hide language selection'),
'#default_value' => isset($element['#default_value']['language_hidden']) ? $element['#default_value']['language_hidden'] : NULL,
'#description' => t('Language selector appears on create and edit pages.'),
'#title' => t('Show language selector on create and edit pages'),
'#default_value' => isset($element['#default_value']['language_show']) ? $element['#default_value']['language_show'] : NULL,
);
// 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) {
* @param array $values
* An array holding the values to be saved having the following keys:
* - 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()) {
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
* @return array
* An array with the following keys:
* - 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) {
$configuration = config('language.settings')->get(language_get_default_configuration_settings_key($entity_type, $bundle));
if (is_null($configuration)) {
$configuration = array();
}
$configuration += array('langcode' => 'site_default', 'language_hidden' => TRUE);
$configuration += array('langcode' => 'site_default', 'language_show' => FALSE);
return $configuration;
}
......
......@@ -36,30 +36,30 @@ public static function getInfo() {
public function testLanguageConfigurationElement() {
$this->drupalGet('language-tests/language_configuration_element');
$edit['lang_configuration[langcode]'] = 'current_interface';
$edit['lang_configuration[language_hidden]'] = TRUE;
$edit['lang_configuration[language_show]'] = FALSE;
$this->drupalPost(NULL, $edit, 'Save');
$lang_conf = language_get_default_configuration('some_custom_type', 'some_bundle');
// Check that the settings have been saved.
$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->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.
$this->drupalGet('language-tests/language_configuration_element');
$edit['lang_configuration[langcode]'] = 'authors_default';
$edit['lang_configuration[language_hidden]'] = FALSE;
$edit['lang_configuration[language_show]'] = TRUE;
$this->drupalPost(NULL, $edit, 'Save');
$lang_conf = language_get_default_configuration('some_custom_type', 'some_bundle');
// Check that the settings have been saved.
$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->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() {
}
// 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');
$this->assertEqual($langcode, 'bb');
// 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');
$language_interface = language(LANGUAGE_TYPE_INTERFACE);
$this->assertEqual($langcode, $language_interface->langcode);
......@@ -93,7 +93,7 @@ public function testDefaultLangcode() {
$new_default = language_load('cc');
$new_default->default = TRUE;
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');
$this->assertEqual($langcode, 'cc');
......@@ -104,7 +104,7 @@ public function testDefaultLangcode() {
$some_user->preferred_langcode = 'bb';
$some_user->save();
$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->assertOptionSelected('edit-langcode', 'bb');
}
......@@ -122,12 +122,12 @@ public function testNodeTypeUpdate() {
$this->drupalLogin($admin_user);
$edit = array(
'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'));
// Check the language default configuration for the articles.
$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.
$edit = array(
'type' => 'article_2'
......@@ -135,6 +135,6 @@ public function testNodeTypeUpdate() {
$this->drupalPost('admin/structure/types/manage/article', $edit, t('Save content type'));
// Check that we still have the settings for the new node type.
$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() {
$this->drupalGet("admin/structure/types/manage/{$type2->type}");
$this->assertText(t('Language settings'), 'Multilingual support widget present on content type configuration form.');
$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->assertRaw(t('The content type %type has been updated.', array('%type' => $type2->name)));
......@@ -159,7 +159,7 @@ function testContentTypeDirLang() {
// Set the content type to use multilingual support.
$this->drupalGet("admin/structure/types/manage/{$type->type}");
$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->assertRaw(t('The content type %type has been updated.', array('%type' => $type->name)));
......
......@@ -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)));
// 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.
variable_set('locale_js_directory', 'js_translations');
// Build the JavaScript translation file for French.
......
......@@ -106,7 +106,7 @@ public function form(array $form, array &$form_state, EntityInterface $node) {
'#type' => 'language_select',
'#default_value' => $node->langcode,
'#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(
......
......@@ -53,7 +53,7 @@ function setUp() {
// Set "Basic page" content type to use multilingual support.
$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->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() {
*/
function testNodeTypeInitialLanguageDefaults() {
$this->drupalGet('admin/structure/types/manage/article');
$this->assertOptionSelected('edit-language-configuration-langcode', 'site_default', 'The default inital language is the site default.');
$this->assertFieldChecked('edit-language-configuration-language-hidden', 'Language selector is hidden by default.');
$this->assertOptionSelected('edit-language-configuration-langcode', 'site_default', 'The default initial language is the site 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.
$this->drupalGet('admin/structure/types/manage/article/fields');
......@@ -66,12 +66,12 @@ function testNodeTypeInitialLanguageDefaults() {
// Tests the initial language after changing the site default language.
// First unhide the language selector.
$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->drupalGet('node/add/article');
$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.
$this->drupalGet('admin/structure/types/manage/article/fields');
......@@ -91,7 +91,7 @@ function testNodeTypeInitialLanguageDefaults() {
);
$this->drupalPost('admin/structure/types/manage/article', $edit, t('Save content type'));
$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() {
update_variable_set('node_type_language_default_' . $type, LANGUAGE_NOT_SPECIFIED);
$node_type_language = update_variable_get('node_type_language_' . $type, 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) {
// Translation was enabled, so enable it again and
// unhide the language selector. Because if language is
// LANGUAGE_NOT_SPECIFIED and the selector hidden, translation
// 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_del('node_type_language_' . $type);
......@@ -627,9 +627,9 @@ function node_update_8007() {
$types = db_query('SELECT type FROM {node_type}')->fetchCol();
foreach ($types as $type) {
$language_default = update_variable_get('node_type_language_default_' . $type, NULL);
$language_hidden = update_variable_get('node_type_language_hidden_' . $type, NULL);
if (isset($language_default) || isset($language_hidden)) {
$values = array('langcode' => $language_default, 'language_hidden' => $language_hidden);
$language_show = update_variable_get('node_type_language_show_' . $type, NULL);
if (isset($language_default) || isset($language_show)) {
$values = array('langcode' => $language_default, 'language_show' => $language_show);
config('language.settings')->set('node.' . $type . '.language.default_configuration', $values)->save();
}
}
......
......@@ -609,7 +609,7 @@ function node_field_extra_fields() {
// node/add form.
if ($module_language_enabled) {
$configuration = language_get_default_configuration('node', $bundle->type);
if (!$configuration['language_hidden']) {
if ($configuration['language_show']) {
$extra['node'][$bundle->type]['form']['language'] = array(
'label' => t('Language'),
'description' => $description,
......
......@@ -51,7 +51,7 @@ function setUp() {
function testAliasTranslation() {
// Set 'page' content type to enable translation.
$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->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() {
// Set "Poll" content type to use multilingual support with translation.
$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->assertRaw(t('The content type %type has been updated.', array('%type' => 'Poll')), 'Poll content type has been updated.');
......
......@@ -86,7 +86,7 @@ function testEntityFormLanguage() {
// Enable language selector.
$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->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) {
'#title' => t('Language'),
'#languages' => LANGUAGE_ALL,
'#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(
......
......@@ -47,7 +47,7 @@ function setUp() {
function testTermLanguage() {
// Configure the vocabulary to not hide the language selector.
$edit = array(
'default_language[language_hidden]' => FALSE,
'default_language[language_show]' => TRUE,
);
$this->drupalPost('admin/structure/taxonomy/' . $this->vocabulary->id() . '/edit', $edit, t('Save'));
......@@ -83,7 +83,7 @@ function testDefaultTermLanguage() {
// default language of the terms fixed.
$edit = array(
'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->drupalGet('admin/structure/taxonomy/' . $this->vocabulary->id() . '/add');
......@@ -92,7 +92,7 @@ function testDefaultTermLanguage() {
// Make the default language of the terms to be the current interface.
$edit = array(
'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->drupalGet('aa/admin/structure/taxonomy/' . $this->vocabulary->id() . '/add');
......@@ -110,7 +110,7 @@ function testDefaultTermLanguage() {
language_save($new_default);
$edit = array(
'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->drupalGet('admin/structure/taxonomy/' . $this->vocabulary->id() . '/add');
......
......@@ -86,7 +86,7 @@ function testVocabularyDefaultLanguageForTerms() {
'name' => $this->randomName(),
'vid' => drupal_strtolower($this->randomName()),
'default_language[langcode]' => 'bb',
'default_language[language_hidden]' => FALSE,
'default_language[language_show]' => TRUE,
);
$vid = $edit['vid'];
$this->drupalPost('admin/structure/taxonomy/add', $edit, t('Save'));
......@@ -98,39 +98,39 @@ function testVocabularyDefaultLanguageForTerms() {
// Check that the language settings were saved.
$language_settings = language_get_default_configuration('taxonomy_term', $edit['vid']);
$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.
$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 = array(
'default_language[langcode]' => 'aa',
'default_language[language_hidden]' => TRUE,
'default_language[language_show]' => FALSE,
);
$this->drupalPost('admin/structure/taxonomy/' . $vid . '/edit', $edit, t('Save'));
// And check again the settings and also the interface.
$language_settings = language_get_default_configuration('taxonomy_term', $vid);
$this->assertEqual($language_settings['langcode'], 'aa');
$this->assertEqual($language_settings['language_hidden'], TRUE);
$this->assertEqual($language_settings['language_show'], FALSE);
$this->drupalGet('admin/structure/taxonomy/' . $vid . '/edit');
$this->assertOptionSelected('edit-default-language-langcode', 'aa', 'The correct default language for the terms of this vocabulary is selected.');
$this->assertFieldChecked('edit-default-language-language-hidden', 'Hide language selection option is not checked.');
$this->assertNoFieldChecked('edit-default-language-language-show', 'Show language selection option is not checked.');
// Check that language settings are changed after editing vocabulary.
$edit = array(
'name' => $this->randomName(),
'default_language[langcode]' => 'authors_default',
'default_language[language_hidden]' => TRUE,
'default_language[language_show]' => FALSE,
);
$this->drupalPost('admin/structure/taxonomy/' . $vid . '/edit', $edit, t('Save'));
// Check that we have the new settings.
$new_settings = language_get_default_configuration('taxonomy_term', $vid);
$this->assertEqual($new_settings['langcode'], 'authors_default');
$this->assertEqual($new_settings['language_hidden'], TRUE);
$this->assertEqual($new_settings['language_show'], FALSE);
}
}
......@@ -51,7 +51,7 @@ function setUp() {
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add language'));
// Set "Article" content type to use multilingual support with translation.
$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/article', $edit, t('Save content type'));
$this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Article')), 'Article content type has been updated.');
}
......
......@@ -51,7 +51,7 @@ function setUp() {
// Set "Basic page" content type to use multilingual support with
// translation.
$this->drupalGet('admin/structure/types/manage/page');
$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/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.');
......@@ -228,7 +228,7 @@ function testLanguageSwitcherBlockIntegration() {
// Disable translation support to check that the language switcher is left
// untouched only for new nodes.
$this->drupalLogin($this->admin_user);
$edit = array('language_configuration[language_hidden]' => TRUE, 'node_type_language_translation_enabled' => FALSE);
$edit = array('language_configuration[language_show]' => FALSE, 'node_type_language_translation_enabled' => FALSE);
$this->drupalPost('admin/structure/types/manage/page', $edit, t('Save content type'));
$this->drupalLogin($this->translator);
......
......@@ -175,7 +175,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']['language_configuration']['langcode']) && $form_state['values']['language_configuration']['language_hidden'] && $form_state['values']['node_type_language_translation_enabled']) {
if (language_is_locked($form_state['values']['language_configuration']['langcode']) && !$form_state['values']['language_configuration']['language_show'] && $form_state['values']['node_type_language_translation_enabled']) {
foreach (language_list(LANGUAGE_LOCKED) as $language) {
$locked_languages[] = $language->name;
}
......
......@@ -70,7 +70,7 @@ function testSettingsUI() {
$edit = array(
'entity_types[comment]' => TRUE,
'settings[comment][comment_node_article][settings][language][langcode]' => LANGUAGE_NOT_SPECIFIED,
'settings[comment][comment_node_article][settings][language][language_hidden]' => TRUE,
'settings[comment][comment_node_article][settings][language][language_show]' => FALSE,
'settings[comment][comment_node_article][translatable]' => TRUE,
'settings[comment][comment_node_article][fields][comment_body]' => TRUE,
);
......@@ -82,7 +82,7 @@ function testSettingsUI() {
$edit = array(
'entity_types[comment]' => TRUE,
'settings[comment][comment_node_article][settings][language][langcode]' => 'current_interface',
'settings[comment][comment_node_article][settings][language][language_hidden]' => FALSE,
'settings[comment][comment_node_article][settings][language][language_show]' => TRUE,
'settings[comment][comment_node_article][translatable]' => TRUE,
'settings[comment][comment_node_article][fields][comment_body]' => TRUE,
);
......@@ -93,7 +93,7 @@ function testSettingsUI() {
// Test that language settings are correctly stored.
$language_configuration = language_get_default_configuration('comment', 'comment_node_article');
$this->assertEqual($language_configuration['langcode'], 'current_interface', 'The default language for article comments is set to the current interface language.');
$this->assertFalse($language_configuration['language_hidden'], 'The language selector for article comments is shown.');
$this->assertTrue($language_configuration['language_show'], 'The language selector for article comments is shown.');
}
/**
......
......@@ -75,7 +75,7 @@ function translation_entity_form_language_content_settings_validate(array $form,
}
$values = $bundle_settings['settings']['language'];
if (language_is_locked($values['langcode']) && $values['language_hidden']) {
if (language_is_locked($values['langcode']) && empty($values['language_show'])) {
foreach (language_list(LANGUAGE_LOCKED) as $language) {
$locked_languages[] = $language->name;
}
......
......@@ -22,7 +22,7 @@ Drupal.behaviors.translationEntity = {
var $bundleSettings = $target.closest('.bundle-settings');
var $fieldSettings = $bundleSettings.nextUntil('.bundle-settings');
if ($target.is(':checked')) {
$bundleSettings.find('.operations :input[name$="[language_hidden]"]').attr('checked', false);
$bundleSettings.find('.operations :input[name$="[language_show]"]').attr('checked', true);
$fieldSettings.find('.translatable :input').attr('checked', true);
$fieldSettings.show();
}
......
......@@ -754,7 +754,7 @@ function translation_entity_language_configuration_element_process(array $elemen
function translation_entity_language_configuration_element_validate($element, array &$form_state, array $form) {
$key = $form_state['translation_entity']['key'];
$values = $form_state['values'][$key];
if (language_is_locked($values['langcode']) && $values['language_hidden'] && $values['translation_entity']) {
if (language_is_locked($values['langcode']) && !$values['language_show'] && $values['translation_entity']) {
foreach (language_list(LANGUAGE_LOCKED) as $language) {
$locked_languages[] = $language->name;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment