Implementation of hook_link().

Display translation links with native language names, if this node is part of a translation set.

File

modules/translation/translation.module, line 158
Manages content translations.

Code

function translation_link($type, $node = NULL, $teaser = FALSE) {
  $links = array();
  if ($type == 'node' && $node->tnid && ($translations = translation_node_get_translations($node->tnid))) {

    // Do not show link to the same node.
    unset($translations[$node->language]);
    $languages = language_list();
    foreach ($languages as $langcode => $language) {
      if (isset($translations[$langcode]) && $translations[$langcode]->status) {
        $links["node_translation_{$langcode}"] = array(
          'title' => $language->native,
          'href' => 'node/' . $translations[$langcode]->nid,
          'language' => $language,
          'attributes' => array(
            'title' => $translations[$langcode]->title,
            'class' => 'translation-link',
          ),
        );
      }
    }
  }
  return $links;
}