0

I'm trying to get a list of language translations that a node has in theme_preprocess_node(). I have the node object and can check for a translation on a one-by-one basis, if I have the list of languages. What I need is a list of all the translations for the node.

1

Use getTranslationLanguages():

$languages = $node->getTranslationLanguages();

foreach ($languages as $id => $language) {
  print $node->getTranslation($id)->label();
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.