diff --git a/core/lib/Drupal/Core/Entity/ContentEntityBase.php b/core/lib/Drupal/Core/Entity/ContentEntityBase.php index 060674d..2ad6d69 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityBase.php @@ -201,13 +201,6 @@ public function postCreate(EntityStorageInterface $storage) { } /** - * @return string - */ - public function getActiveLangcode() { - return $this->activeLangcode; - } - - /** * {@inheritdoc} */ public function setNewRevision($value = TRUE) { diff --git a/core/modules/taxonomy/src/Plugin/Field/FieldFormatter/TaxonomyFormatterBase.php b/core/modules/taxonomy/src/Plugin/Field/FieldFormatter/TaxonomyFormatterBase.php index 4ed9e71..83e5ef4 100644 --- a/core/modules/taxonomy/src/Plugin/Field/FieldFormatter/TaxonomyFormatterBase.php +++ b/core/modules/taxonomy/src/Plugin/Field/FieldFormatter/TaxonomyFormatterBase.php @@ -26,7 +26,7 @@ public function prepareView(array $entities_items) { // Collect every possible term attached to any of the fieldable entities. /** @var \Drupal\Core\Field\EntityReferenceFieldItemList $items */ foreach ($entities_items as $items) { - $active_langcode = $items->getParent()->getActiveLangcode(); + $active_langcode = $items->getParent()->language()->id; /** @var \Drupal\taxonomy\Entity\Term $term */ foreach ($items->referencedEntities() as $term) { if ($term->hasTranslation($active_langcode)) { diff --git a/core/modules/taxonomy/src/Tests/TermTranslationFieldViewTest.php b/core/modules/taxonomy/src/Tests/TermTranslationFieldViewTest.php index 653847a..f199bf3 100644 --- a/core/modules/taxonomy/src/Tests/TermTranslationFieldViewTest.php +++ b/core/modules/taxonomy/src/Tests/TermTranslationFieldViewTest.php @@ -43,14 +43,14 @@ class TermTranslationFieldViewTest extends TaxonomyTestBase { * * @var string */ - protected $baseLangCode = 'en'; + protected $baseLangcode = 'en'; /** - * The langcode to have translations into. + * Target langcode for translation. * * @var string */ - protected $translateToLangCode = 'hu'; + protected $translateToLangcode = 'hu'; /** * The tag in the source language. @@ -94,7 +94,7 @@ protected function setUp() { */ public function testTranslatedTaxonomyTermreferenceDisplay() { $path = 'node/' . $this->node->id(); - $translation_path = $this->translateToLangCode . '/' . $path; + $translation_path = $this->translateToLangcode . '/' . $path; $this->drupalGet($path); $this->assertNoText($this->translatedTagName); @@ -108,7 +108,7 @@ public function testTranslatedTaxonomyTermreferenceDisplay() { * Adds additional languages. */ protected function setupLanguages() { - ConfigurableLanguage::createFromLangcode($this->translateToLangCode)->save(); + ConfigurableLanguage::createFromLangcode($this->translateToLangcode)->save(); } /** @@ -117,17 +117,17 @@ protected function setupLanguages() { protected function setUpNode() { /** @var \Drupal\node\Entity\Node $node */ $node = entity_create('node', array( - 'name' => $this->randomMachineName(), + 'title' => $this->randomMachineName(), 'type' => 'article', 'description' => array( 'value' => $this->randomMachineName(), 'format' => 'basic_html', ), $this->termFieldName => array(array('target_id' => $this->term->id())), - 'langcode' => $this->baseLangCode, + 'langcode' => $this->baseLangcode, )); $node->save(); - $node->addTranslation($this->translateToLangCode, array()); + $node->addTranslation($this->translateToLangcode, array()); $node->save(); $this->node = $node; } @@ -151,10 +151,10 @@ protected function enableTranslation() { protected function setUpTerm() { $this->term = $this->createTerm($this->vocabulary, array( 'name' => $this->baseTagName, - 'langcode' => $this->baseLangCode, + 'langcode' => $this->baseLangcode, )); - $this->term->addTranslation($this->translateToLangCode, array( + $this->term->addTranslation($this->translateToLangcode, array( 'name' => $this->translatedTagName, )); $this->term->save(); @@ -197,5 +197,4 @@ protected function setUpTermReferenceField() { )) ->save(); } - }