public function TMGMTEntitySourcePluginController::getData in Translation Management Tool 7
Returns the data from the fields as a structure that can be processed by the Translation Management system.
Overrides TMGMTSourcePluginControllerInterface::getData
File
- sources/
entity/ tmgmt_entity.plugin.inc, line 28 - Provides the Entity source controller.
Class
- TMGMTEntitySourcePluginController
- @file Provides the Entity source controller.
Code
public function getData(TMGMTJobItem $job_item) {
$entity = entity_load_single($job_item->item_type, $job_item->item_id);
if (!$entity) {
throw new TMGMTException(t('Unable to load entity %type with id %id', array(
'%type' => $job_item->item_type,
$job_item->item_id,
)));
}
if (entity_language($job_item->item_type, $entity) == LANGUAGE_NONE) {
throw new TMGMTException(t('Entity %entity could not be translated because it is language neutral', array(
'%entity' => entity_label($job_item->item_type, $entity),
)));
}
return tmgmt_field_get_source_data($job_item->item_type, $entity, $job_item
->getJob()->source_language, TRUE);
}