How to theme language translation links in Drupal?
-
20-09-2019 - |
Question
In my Drupal 6 installation, using the standard Content Translation module, links to translated versions of a node is added below the content.
How do I output those links another place in my theme?
To be more precise, I would like to output the links (if there are any) in my right toolbar.
Thanks, Egil.
Solution
In most themes, those links are just called $links in your page.tpl.php, so you can just move $links to your right sidebar instead of where they are now in your page.tpl.php.
However, that has the added pitfall of also moving all other links with them (such as "add new comment", "read more", etc.), so to fix that you'll have to do some funky stuff in template.php (THEMENAME_preprocess_page() specifically) that basically removes the translation links from $links and outputs them as a separate object (something like $translationlinks), then put THAT where you want it.
OTHER TIPS
create block with php filter:
$node = menu_get_object();
if ($node->links) {
print theme('links', $node->links);
}