Commit 55a6dd8f authored by webchick's avatar webchick

Issue #1912992 by swentel, beretta627, amateescu, mitron: Fixed Language Field...

Issue #1912992 by swentel, beretta627, amateescu, mitron: Fixed Language Field gets 'Stuck' after Title.
parent d3e4632a
......@@ -65,8 +65,8 @@ public function buildContent(array $entities, array $displays, $view_mode, $lang
);
// Add Language field text element to node render array.
if ($display->getComponent('language')) {
$entity->content['language'] = array(
if ($display->getComponent('langcode')) {
$entity->content['langcode'] = array(
'#type' => 'item',
'#title' => t('Language'),
'#markup' => language_name($langcode),
......
......@@ -76,15 +76,15 @@ function testNodeTypeInitialLanguageDefaults() {
// Tests if the language field can be rearranged on the manage form display
// tab.
$this->drupalGet('admin/structure/types/manage/article/form-display');
$language_field = $this->xpath('//*[@id="language"]');
$language_field = $this->xpath('//*[@id="langcode"]');
$this->assert(!empty($language_field), 'Language field is visible on manage form display tab.');
// Tests if the language field can be rearranged on the manage display tab.
$this->drupalGet('admin/structure/types/manage/article/display');
$language_display = $this->xpath('//*[@id="language"]');
$language_display = $this->xpath('//*[@id="langcode"]');
$this->assert(!empty($language_display), 'Language field is visible on manage display tab.');
// Tests if the language field is hidden by default.
$this->assertOptionSelected('edit-fields-language-type', 'hidden', 'Language is hidden by default on manage display tab.');
$this->assertOptionSelected('edit-fields-langcode-type', 'hidden', 'Language is hidden by default on manage display tab.');
// Changes the inital language settings.
$edit = array(
......@@ -117,11 +117,11 @@ function testLanguageFieldVisibility() {
// Changes Language field visibility to true and check if it is saved.
$edit = array(
'fields[language][type]' => 'visible',
'fields[langcode][type]' => 'visible',
);
$this->drupalPostForm('admin/structure/types/manage/article/display', $edit, t('Save'));
$this->drupalGet('admin/structure/types/manage/article/display');
$this->assertOptionSelected('edit-fields-language-type', 'visible', 'Language field has been set to visible.');
$this->assertOptionSelected('edit-fields-langcode-type', 'visible', 'Language field has been set to visible.');
// Loads node page and check if Language field is shown.
$this->drupalGet('node/' . $node->id());
......
......@@ -462,14 +462,14 @@ function node_field_extra_fields() {
if ($module_language_enabled) {
$configuration = language_get_default_configuration('node', $bundle->type);
if ($configuration['language_show']) {
$extra['node'][$bundle->type]['form']['language'] = array(
$extra['node'][$bundle->type]['form']['langcode'] = array(
'label' => t('Language'),
'description' => $description,
'weight' => 0,
);
}
}
$extra['node'][$bundle->type]['display']['language'] = array(
$extra['node'][$bundle->type]['display']['langcode'] = array(
'label' => t('Language'),
'description' => $description,
'weight' => 0,
......
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