7

Normally, I would get the active language used for a page from the global variable $language.

I have a node whose body is using the PHP code input filter. Within that PHP code, I am not able to get the content language.

How can I get the content language?

2 Answers 2

10

If I understand your question:

global $language_content;

This will return a language object with the current language.

1
3

It also works within a block. I created a PHP block where I wanted to customize a link with the language variable, and placed this code inside:

<?php global $language_content; print $language_content->language; ?>

Thank you for sharing!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.