Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit bc274a47 authored by drishu's avatar drishu
Browse files

OEL-1167: Account for language und.

parent 5eaf632d
No related branches found
No related tags found
2 merge requests!102Merge 1.x into EPIC-OEL-1255-migrate-paragraphs.,!94OEL-1167: Theme the content language switcher
......@@ -39,20 +39,24 @@ function oe_whitelabel_multilingual_preprocess_links__oe_multilingual_content_la
$entity = $multilingual_helper->getEntityFromCurrentRoute();
/** @var \Drupal\Core\Entity\EntityInterface $translation */
$translation = $multilingual_helper->getCurrentLanguageEntityTranslation($entity);
$variables['languages'][] = [
'path' => $translation->toUrl()->setAbsolute(TRUE)->toString(),
'hreflang' => $translation->language()->getId(),
'label' => $languages[$translation->language()->getId()]->getName(),
'current' => TRUE,
'icon_position' => 'before',
'remove_icon_spacers' => FALSE,
'icon' => [
'name' => 'check-lg',
'path' => $variables['bcl_icon_path'],
'size' => 'xs',
'#attributes' => ['class' => ['me-2']],
],
];
// If we don't have a language id defined yet, the current translation wasn't
// saved, so we don't add it to the list.
if ($translation->language()->getId() !== 'und') {
$variables['languages'][] = [
'path' => $translation->toUrl()->setAbsolute(TRUE)->toString(),
'hreflang' => $translation->language()->getId(),
'label' => $languages[$translation->language()->getId()]->getName(),
'current' => TRUE,
'icon_position' => 'before',
'remove_icon_spacers' => FALSE,
'icon' => [
'name' => 'check-lg',
'path' => $variables['bcl_icon_path'],
'size' => 'xs',
'#attributes' => ['class' => ['me-2']],
],
];
}
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment