1 node.block.inc | NodeBlock::loadTranslatedNode() |
File
- core/
modules/ node/ node.block.inc, line 101 - A class that displays a particular node in a block.
Class
- NodeBlock
- @file A class that displays a particular node in a block.
Code
function loadTranslatedNode() {
global $language;
$node = node_load($this->settings['nid']);
if (!empty($node->tnid) && !empty($node->langcode)) {
$translations = translation_node_get_translations($node->tnid);
foreach ($translations as $code => $translation) {
if ($code == $language->langcode) {
return node_load($translation->nid);
}
}
}
return $node;
}