Skip to content

Commit

Permalink
Merge pull request #904 from City-of-Helsinki/UHF-8909
Browse files Browse the repository at this point in the history
UHF-8909 District languages
  • Loading branch information
khalima authored Aug 30, 2024
2 parents 183ddea + 10cd4c0 commit dac3037
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions public/themes/custom/hdbt_subtheme/hdbt_subtheme.theme
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,10 @@ function hdbt_subtheme_preprocess_node(array &$variables) {
continue;
}
$district_title = $district_node->getTitle();

if ($district_node->hasTranslation($variables['current_langcode'])) {
$district_title = $district_node->getTranslation($variables['current_langcode'])->getTitle();
$language = \Drupal::languageManager()
->getCurrentLanguage(LanguageInterface::TYPE_CONTENT);
if ($district_node->hasTranslation($language->getId())) {
$district_title = $district_node->getTranslation($language->getId())->getTitle();
}

$district_titles[] = $district_title;
Expand Down

0 comments on commit dac3037

Please sign in to comment.