You are here

private function RequestTranslationApproveForm::checkoutSettingsForm in TMGMT Extension Suite 8

Helper function for retrieving the job settings form.

1 call to RequestTranslationApproveForm::checkoutSettingsForm()
RequestTranslationApproveForm::buildForm in src/Form/RequestTranslationApproveForm.php
Form constructor.

File

src/Form/RequestTranslationApproveForm.php, line 220

Class

RequestTranslationApproveForm

Namespace

Drupal\tmgmt_extension_suit\Form

Code

private function checkoutSettingsForm(FormStateInterface $form_state, JobInterface $job) {
  $form = [];
  if (!$job
    ->hasTranslator()) {
    return $form;
  }
  $translator = $job
    ->getTranslator();
  $result = $translator
    ->checkAvailable();
  if (!$result
    ->getSuccess()) {
    $form['#description'] = $result
      ->getReason();
    return $form;
  }
  $result = $translator
    ->checkTranslatable($job);
  if ($job
    ->getTargetLangcode() && !$result
    ->getSuccess()) {
    $form['#description'] = $result
      ->getReason();
    return $form;
  }
  $plugin_ui = $this->translatorManager
    ->createUIInstance($translator
    ->getPluginId());
  $form = $plugin_ui
    ->checkoutSettingsForm($form, $form_state, $job);
  return $form;
}