translation_path_get_translations

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

modules/translation/translation.module, строка 320

Версии
6
translation_path_get_translations($path)

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

Параметры

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

Возвращаемое значение

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

Код

<?php
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;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему