public function TMGMTEntitySourcePluginController::getExistingLangCodes in Translation Management Tool 7
Gets existing translation language codes of the job item source.
Returns language codes that can be used as the source language for a translation job.
Parameters
TMGMTJobItem $job_item: The job item.
Return value
array Array of language codes.
Overrides TMGMTDefaultSourcePluginController::getExistingLangCodes
File
- sources/
entity/ tmgmt_entity.plugin.inc, line 99 - Provides the Entity source controller.
Class
- TMGMTEntitySourcePluginController
- @file Provides the Entity source controller.
Code
public function getExistingLangCodes(TMGMTJobItem $job_item) {
if ($entity = entity_load_single($job_item->item_type, $job_item->item_id)) {
$entity_info = entity_get_info($job_item->item_type);
if (isset($entity_info['entity keys']['translations'])) {
$translations_key = $entity_info['entity keys']['translations'];
return array_keys($entity->{$translations_key}->data);
}
}
return array();
}