Quantcast
Viewing all articles
Browse latest Browse all 295783

OverviewTerms doesn't respect the current content language when building the form and term urls and names are generated based on the terms default language

Problem/Motivation

OverviewTerms doesn't respect the current content language when building the form and term urls and names are generated based on the terms default language.

Proposed resolution

The entity manager is passed in the constructor, so we just have to keep a reference of it and when working with the terms first get the term in the language determined by the current context by executing:
$term = $this->entityManager->getTranslationFromContext($term);.

The EntityManager service is deprecated and will be removed before Drupal 9.0.0 and the function getTranslationFromContext is provided by the EntityRepository service, but the constructor of OverviewTerms now has as a parameter the EntityManager service and to add another constructor parameter will be API break. To allow for the patch to get in 8.0.x or 8.1.x we still use the EntityManager service, which is already there instead of altering the constructor.

Remaining tasks

Write tests.

User interface changes

Terms and their urls are now pointing not to the default term language, but to the translation language determined by the current context.

API changes

none

Data model changes

none


Viewing all articles
Browse latest Browse all 295783

Trending Articles