I'm trying to figure out how to get the name of the language of the current node in display suite. I find a language option under one of the node categories in the dynamic field content selector, but that outputs the language code, not the name. Do I need to handle this in a preprocess function or is there some way of getting this that I've not managed to find?

2 Answers 2


I didn't find anything there available for clickers. I could suggest the following alternative:

  1. Activate the "Display Suite Format" module
  2. Create Display Suite "Code field" with following content:

      return t(locale_language_name($entity->language));
  3. Don't forget to activate the "Display Suite code" text format for this code field.
  4. Add this code field to your content type's display!

Hope this helps!

  • That does look better than what I've done. I got tied up doing something else, but shortly I'll try this out. Thanks!
    – UltraBob
    May 20, 2016 at 23:46

Here's what I've done. I'd love a better answer:

in my templates.php in my theme (the dynamic field I created in display suite is called language):

function MYTHEME_preprocess_field(&$variables) {
    if ($fieldname == 'language') {
        $item['#markup'] = locale_language_name($item['#markup']);

Your Answer

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

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