spencer95
2/11/2015 - 9:45 AM

Get all translations of node and print the link for the current language.

Get all translations of node and print the link for the current language.

    global $language;
    $translations = translation_path_get_translations("node/42");
    /*
    Returns the paths of all translations of a node, based on its Drupal path:
    array(2) {
        ["de"]=>string(7) "node/42"
        ["en"]=>string(7) "node/43"
    }
    */
    print l(t('Link Title'), $translations[$language->language]); //l() will return the alias to node/42