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 Answer
Use getTranslationLanguages():
$languages = $node->getTranslationLanguages();
foreach ($languages as $id => $language) {
print $node->getTranslation($id)->label();
}