You are here

public function TMGMTNodeSourcePluginController::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/node/tmgmt_node.plugin.inc, line 140
Provides the node source plugin controller.

Class

TMGMTNodeSourcePluginController
@file Provides the node source plugin controller.

Code

public function getExistingLangCodes(TMGMTJobItem $job_item) {
  $existing_lang_codes = array();
  if ($node = node_load($job_item->item_id)) {
    $existing_lang_codes = array(
      entity_language('node', $node),
    );
  }
  if ($translations = translation_node_get_translations($job_item->item_id)) {
    $existing_lang_codes = array_unique(array_merge($existing_lang_codes, array_keys($translations)));
  }
  return $existing_lang_codes;
}