function title_entity_language in Title 7
Provide the original entity language.
If a language property is defined for the current entity we synchronize the field value using the entity language, otherwise we fall back to LANGUAGE_NONE.
Parameters
$entity_type:
$entity:
Return value
A language code
2 calls to title_entity_language()
- title_entity_presave in ./
title.module - Implements hook_entity_presave().
- title_entity_sync in ./
title.module - Synchronize replaced fields with the regular field values.
File
- ./
title.module, line 577
Code
function title_entity_language($entity_type, $entity) {
if (module_exists('entity_translation') && entity_translation_enabled($entity_type)) {
$handler = entity_translation_get_handler($entity_type, $entity, TRUE);
$langcode = $handler
->getLanguage();
}
else {
$langcode = entity_language($entity_type, $entity);
}
return !empty($langcode) ? $langcode : LANGUAGE_NONE;
}