4

I'm having a difficult time diagnosing a problem on a site I'm working on. By default on a multilingual site Drupal puts "content translation links" at the bottom of nodes. I've disabled the content translation links in favor of the language switcher block. However, on the contact form from the contact module I still have what look like content translation links at the bottom of the form (see screenshot below).

screenshot of contact form

In the screenshot the translation links that I don't want are labeled #1 and the language switcher block is labeled #2.

I've selected "hide content translation links" under /admin/settings/language/i18n , but I guess this doesn't apply to the contact form for some reason.

So far I've been able to deduce that these links are getting passed through the $content variable because when I remove print $content from page.tpl.php, the links (as well as the contact form itself, of course) disappear. It also seems that the links are being treated as part of the contact form itself; when I tried using the panels site contact page override, whenever I added the contact form widget the links were included.

I apologize if this is perhaps too "localized" (pardon the unintentional pun) a question, but any help with figuring out how to get rid of these content translation links from the contact form page would be greatly appreciated. On the one hand I highly doubt this is the expected default behavior, so I feel like I must have tripped a setting or missed a setting somewhere. But at the same time I've looked through pretty much everything I can think of, so I'm at a loss.

  • 1
    It can be helpful when you tag your post with the Drupal version you're using ('drupal-6', 'drupal-7' etc.) – marcvangend Mar 25 '11 at 12:25
  • Ah, I know... "Send e-mail", that's the Drupal 6 contact form. – marcvangend Mar 25 '11 at 12:32
  • I tried tagging it as drupal-6 but I got an error saying that drupal-6 was a new tag and it didn't show up on autocomplete. I meant to edit my post to say it was for D6, but I forgot. Sorry. – Jay Mar 25 '11 at 12:42
1

If this is a contact form problem only, you might be able to remove the links with hook_form_alter or alternatively css.

  • Hmm, ok. I'm new to using hooks and custom modules, so I'll try to do some research and see if I can figure it out. – Jay Mar 26 '11 at 7:10
2

If you want to hide that button, you can use the CSS Injector module, create a CSS class to apply to that data, and set display:none !important. It's not necessary to use a Drupal hook.

2

If you use Drupal 7, you can put hide($content['language']); in node.tpl.php.

1

This is not only a Drupal 6 issue, I had the same problem on Drupal 7 until I solved it and found this discussion. My solution was to implement template_preprocess_node() in template.php and simply unset $variables['content']['links']['translation'].

Unlike Laxman i couldn't find any data in $content['language'] in node.tpl.php and I don't think such variable exist. You can try this with var_dump($content['language']); and you'll get an empty result. However, var_dump($content['links']['translation']); will result in an array containing information on what languages current node has translations for.

A lot of help came from reading about translation_node_view in the Drupal API.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.