function translation_path_get_translations

7.x translation.module translation_path_get_translations($path)
6.x translation.module translation_path_get_translations($path)

Return paths of all translations of a node, based on its Drupal path.

Parameters

$path: A Drupal path, for example node/432.

Return value

An array of paths of translations of the node accessible to the current user keyed with language codes.

1 call to translation_path_get_translations()
translation_translation_link_alter in drupal-6.x/modules/translation/translation.module
Implementation of hook_translation_link_alter().

File

drupal-6.x/modules/translation/translation.module, line 321
Manages content translations.

Code

function translation_path_get_translations($path) {
  $paths = array();
  // Check for a node related path, and for its translations.
  if ((preg_match("!^node/([0-9]+)(/.+|)$!", $path, $matches)) && ($node = node_load((int) $matches[1])) && !empty($node->tnid)) {
    foreach (translation_node_get_translations($node->tnid) as $language => $translation_node) {
      $paths[$language] = 'node/' . $translation_node->nid . $matches[2];
    }
  }
  return $paths;
}