Requests the translation of a JobItem.
JobItemInterface[] $job_items: The JobItem we want to translate.
Overrides ContinuousTranslatorInterface::requestJobItemsTranslation
public function requestJobItemsTranslation(array $job_items) {
/** @var \Drupal\tmgmt\Entity\Job $job */
$job = reset($job_items)
->getJob();
$tuid = $job
->getSetting('translator');
// Create local task for this job.
/** @var \Drupal\tmgmt_local\LocalTaskInterface $local_task */
$local_task = LocalTask::create(array(
'uid' => $job
->getOwnerId(),
'tuid' => $tuid,
'tjid' => $job
->id(),
'title' => $job
->label(),
));
// If we have translator then switch to pending state.
if ($tuid) {
$local_task->status = LocalTaskInterface::STATUS_PENDING;
}
$local_task
->save();
// Create task items.
foreach ($job_items as $item) {
$local_task
->addTaskItem($item);
$item
->active();
}
}