You are here

function lingotek_entity_langcode in Lingotek Translation 7.5

Same name and namespace in other branches
  1. 7.7 lingotek.util.inc \lingotek_entity_langcode()
  2. 7.6 lingotek.util.inc \lingotek_entity_langcode()
1 call to lingotek_entity_langcode()
lingotek_entity_translation_save_status in ./lingotek.util.inc
Save a translation to the Entity Translation table with status and additional parameters

File

./lingotek.util.inc, line 2004
Utility functions.

Code

function lingotek_entity_langcode($entity_type, $entity) {
  $info = entity_get_info($entity_type);

  // Default to string 'language' if no language-related entity key is found.
  $lang_key = !empty($info['entity keys']['language']) ? $info['entity keys']['language'] : 'language';
  return !empty($entity->{$lang_key}) ? $entity->{$lang_key} : NULL;
}