Helper function for retrieving the job settings form.
@todo Make use of the response object here.
function checkoutSettingsForm(FormStateInterface $form_state, JobInterface $job) {
$form = array();
if (!$job
->hasTranslator()) {
return $form;
}
$translator = $job
->getTranslator();
$result = $translator
->checkAvailable();
if (!$result
->getSuccess()) {
$form['#description'] = $result
->getReason();
return $form;
}
// @todo: if the target language is not defined, the check will not work if the first language in the list is not available.
$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;
}