public function TMGMTJob::addTranslatedData in Translation Management Tool 7
Store translated data back into the items.
Parameters
$data: Partially or complete translated data, the most upper key needs to be the translation job item id.
$key: (Optional) Either a flattened key (a 'key1][key2][key3' string) or a nested one, e.g. array('key1', 'key2', 'key2'). Defaults to an empty array which means that it will replace the whole translated data array. The most upper key entry needs to be the job id (tjiid).
File
- entity/
tmgmt.entity.job.inc, line 769
Class
- TMGMTJob
- Entity class for the tmgmt_job entity.
Code
public function addTranslatedData($data, $key = NULL) {
$key = tmgmt_ensure_keys_array($key);
$items = $this
->getItems();
// If there is a key, get the specific item and forward the call.
if (!empty($key)) {
$item_id = array_shift($key);
if (isset($items[$item_id])) {
$items[$item_id]
->addTranslatedData($data, $key);
}
}
else {
foreach ($data as $key => $value) {
if (isset($items[$key])) {
$items[$key]
->addTranslatedData($value);
}
}
}
}