You are here

public function SmartlingTranslatorUi::checkoutInfo in TMGMT Translator Smartling 8.2

Same name and namespace in other branches
  1. 8.4 src/SmartlingTranslatorUi.php \Drupal\tmgmt_smartling\SmartlingTranslatorUi::checkoutInfo()
  2. 8 src/SmartlingTranslatorUi.php \Drupal\tmgmt_smartling\SmartlingTranslatorUi::checkoutInfo()
  3. 8.3 src/SmartlingTranslatorUi.php \Drupal\tmgmt_smartling\SmartlingTranslatorUi::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

src/SmartlingTranslatorUi.php, line 466
Contains \Drupal\tmgmt_smartling\SmartlingTranslatorUi.

Class

SmartlingTranslatorUi
Smartling translator UI.

Namespace

Drupal\tmgmt_smartling

Code

public function checkoutInfo(JobInterface $job) {

  // If the job is finished, it's not possible to import translations anymore.
  if ($job
    ->isFinished()) {
    return parent::checkoutInfo($job);
  }
  $output = [];
  try {
    $output = array(
      '#type' => 'fieldset',
      '#title' => t('Import translated file'),
    );
    $output['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Download'),
      '#submit' => [
        'tmgmt_smartling_download_file_submit',
      ],
    );
    $output = $this
      ->checkoutInfoWrapper($job, $output);
  } catch (Exception $e) {
  }
  return $output;
}