function lingotek_entity_load_single in Lingotek Translation 7.7
Same name and namespace in other branches
- 7.4 lingotek.module \lingotek_entity_load_single()
- 7.5 lingotek.module \lingotek_entity_load_single()
- 7.6 lingotek.module \lingotek_entity_load_single()
25 calls to lingotek_entity_load_single()
- lingotek_add_language_specific_targets in ./
lingotek.util.inc - Adds a languages specific target to the TMS
- lingotek_cleanup_message_types in ./
lingotek.util.inc - Set all message types with empty or undefined languages to be the site's default language
- lingotek_cleanup_notify_entity_translation in ./
lingotek.util.inc - Report all Lingotek translations to the Entity Translation module
- lingotek_entity_download in ./
lingotek.module - lingotek_entity_download_triggered in ./
lingotek.module
File
- ./
lingotek.module, line 1483
Code
function lingotek_entity_load_single($entity_type, $entity_id) {
$entity = NULL;
if ($entity_type == 'node') {
$entity = lingotek_node_load_default($entity_id);
}
else {
$entities = entity_load($entity_type, array(
$entity_id,
));
if (empty($entities[$entity_id])) {
return;
}
$entity = $entities[$entity_id];
// Handle field collections, both beta7 and beta8
if ($entity_type == 'field_collection_item') {
if (method_exists($entity, 'langcode')) {
$entity->language = $entity
->langcode();
}
else {
$entity->language = LANGUAGE_NONE;
}
}
// Beans don't load a language property, so we'll assign it.
if ($entity_type == 'bean') {
$entity->language = lingotek_get_bean_source($entity->bid);
}
// Groups don't load a language property, so we'll assign it.
if ($entity_type == 'group') {
$language = lingotek_get_group_source($entity->gid);
$entity->language = $language;
}
// Paragraphs don't load a language property, so we'll assign it.
if ($entity_type == 'paragraphs_item') {
$language = lingotek_get_paragraphs_item_source($entity->item_id);
$entity->language = $language;
}
if ($entity_type == 'file') {
$entity->language = lingotek_get_file_source($entity->fid);
}
}
return $entity;
}