Commit 7e41e96c authored by alexpott's avatar alexpott
Browse files

Issue #2161177 by plopesc, yched: 'language' extra field doesn't display the...

Issue #2161177 by plopesc, yched: 'language' extra field doesn't display the language selected in the node form.
parent 31584f02
......@@ -50,7 +50,7 @@ public function buildContent(array $entities, array $displays, $view_mode, $lang
$entity->content['langcode'] = array(
'#type' => 'item',
'#title' => t('Language'),
'#markup' => $this->languageManager->getLanguageName($langcode),
'#markup' => $entity->language()->name,
'#prefix' => '<div id="field-language-display">',
'#suffix' => '</div>'
);
......
<?php
/**
* @file
* Contains \Drupal\node\Tests\NodeViewLanguageTest.
*/
namespace Drupal\node\Tests;
use Drupal\Core\Language\Language;
/**
* Tests the node language extra field display.
*/
class NodeViewLanguageTest extends NodeTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('node', 'datetime', 'language');
public static function getInfo() {
return array(
'name' => 'Node view language field',
'description' => 'Tests the language extra field display.',
'group' => 'Node',
);
}
/**
* Tests the language extra field display.
*/
public function testViewLanguage() {
// Add Spanish language.
$language = new Language(array('id' => 'es'));
language_save($language);
// Set language field visible.
entity_get_display('node', 'page', 'full')
->setComponent('langcode')
->save();
// Create a node in Spanish.
$node = $this->drupalCreateNode(array('langcode' => 'es'));
$this->drupalGet($node->getSystemPath());
$this->assertText('Spanish','The language field is displayed properly.');
}
}
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