public function FileTranslatorUi::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_file/src/FileTranslatorUi.php, line 116

Class

FileTranslatorUi
File translator UI.

Namespace

Drupal\tmgmt_file

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);
  }
  $form = array(
    '#type' => 'fieldset',
    '#title' => t('Import translated file'),
  );
  $supported_formats = array_keys(\Drupal::service('plugin.manager.tmgmt_file.format')
    ->getDefinitions());
  $form['file'] = array(
    '#type' => 'file',
    '#title' => t('File'),
    '#size' => 50,
    '#description' => t('Supported formats: @formats.', array(
      '@formats' => implode(', ', $supported_formats),
    )),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Import'),
    '#submit' => array(
      'tmgmt_file_import_form_submit',
    ),
  );
  return $this
    ->checkoutInfoWrapper($job, $form);
}