public function LocalTranslatorUi::checkoutInfo

Retrieves information about a translation job.

Services based translators with remote states should place a Poll button here to sync the job state.

Parameters

\Drupal\tmgmt\JobInterface $job: The translation job.

Overrides TranslatorPluginUiBase::checkoutInfo

File

translators/tmgmt_local/src/LocalTranslatorUi.php, line 46

Class

LocalTranslatorUi
Drupal user provider plugin UI.

Namespace

Drupal\tmgmt_local

Code

public function checkoutInfo(JobInterface $job) {
  $tuid = $job
    ->getSetting('translator');
  if ($tuid && ($translator = User::load($tuid))) {
    $form['job_status'] = array(
      '#type' => 'item',
      '#title' => t('Job status'),
      '#markup' => t('Translation job is assigned to %name.', array(
        '%name' => $translator
          ->getDisplayName(),
      )),
    );
  }
  else {
    $form['job_status'] = array(
      '#type' => 'item',
      '#title' => t('Job status'),
      '#markup' => t('Translation job is not assigned to any user.'),
    );
  }
  if ($job
    ->getSetting('job_comment')) {
    $form['job_comment'] = array(
      '#type' => 'item',
      '#title' => t('Job comment'),
      '#markup' => Xss::filter($job
        ->getSetting('job_comment')),
    );
  }
  return $form;
}