function i18n_node_translation_link in Internationalization 7
Create link for node translation. This may be a 'edit' or a 'add translation' link.
1 call to i18n_node_translation_link()
- i18n_node_translation_overview in i18n_node/
i18n_node.pages.inc - Overview page for a node's translations.
File
- i18n_node/
i18n_node.pages.inc, line 112 - User page callbacks for the translation module.
Code
function i18n_node_translation_link($text, $path, $langcode, $options = array()) {
$type = variable_get('translation_language_type', LANGUAGE_TYPE_INTERFACE);
$links = language_negotiation_get_switch_links($type, $path);
// When node not published, links don't have href so we use path instead
// Note: this is a bug in Core translation module, see http://drupal.org/node/1137074
if (!empty($links->links[$langcode]) && !empty($links->links[$langcode]['href'])) {
$options += array(
'attributes' => array(),
'html' => FALSE,
);
$options['attributes'] += $links->links[$langcode]['attributes'];
$options += $links->links[$langcode];
$path = $links->links[$langcode]['href'];
}
return l($text, $path, $options);
}