diff -u b/sources/tmgmt_config/src/Tests/ConfigSourceUiTest.php b/sources/tmgmt_config/src/Tests/ConfigSourceUiTest.php --- b/sources/tmgmt_config/src/Tests/ConfigSourceUiTest.php +++ b/sources/tmgmt_config/src/Tests/ConfigSourceUiTest.php @@ -137,8 +137,8 @@ ); $this->drupalPostForm(NULL, $edit, t('Save')); - // Verify that the an error message for the translator exists. - $this->assertText(t('The job item could not be saved because the job does not have a translator assigned.')); + // Verify that we are on the checkout page. + $this->assertResponse(200); } /** diff -u b/src/Form/JobItemForm.php b/src/Form/JobItemForm.php --- b/src/Form/JobItemForm.php +++ b/src/Form/JobItemForm.php @@ -205,9 +205,6 @@ $translator_ui = $this->translatorManager->createUIInstance($item->getTranslator()->getPluginId()); $translator_ui->reviewFormValidate($form, $form_state, $item); } - else { - $form_state->setErrorByName('accept', $this->t('The job item could not be saved because the job does not have a translator assigned.')); - } foreach ($form_state->getValues() as $key => $value) { if (is_array($value) && isset($value['translation'])) { // If there is an empty field then sets and error to fill it. @@ -228,30 +225,30 @@ $source_ui = $this->sourceManager->createUIInstance($item->getPlugin()); $source_ui->reviewFormSubmit($form, $form_state, $item); // Invoke the submit method on the translator controller (if available). - if ($item->getTranslator()){ + if ($item->hasTranslator()) { $translator_ui = $this->translatorManager->createUIInstance($item->getTranslator()->getPluginId()); $translator_ui->reviewFormSubmit($form, $form_state, $item); - } - // Write changes back to item. - foreach ($form_state->getValues() as $key => $value) { - if (is_array($value) && isset($value['translation'])) { - // Update the translation, this will only update the translation in case - // it has changed. We have two different cases, the first is for nested - // texts. - if (is_array($value['translation'])) { - $data = array( - '#text' => $value['translation']['value'], - '#origin' => 'local', - ); - } - else { - $data = array( - '#text' => $value['translation'], - '#origin' => 'local', - ); - } - $item->addTranslatedData($data, $key); + // Write changes back to item. + foreach ($form_state->getValues() as $key => $value) { + if (is_array($value) && isset($value['translation'])) { + // Update the translation, this will only update the translation in case + // it has changed. We have two different cases, the first is for nested + // texts. + if (is_array($value['translation'])) { + $data = array( + '#text' => $value['translation']['value'], + '#origin' => 'local', + ); + } else { + $data = array( + '#text' => $value['translation'], + '#origin' => 'local', + ); + } + + $item->addTranslatedData($data, $key); + } } } // Check if the user clicked on 'Accept', 'Submit' or 'Reject'.