diff -u b/tests/src/Kernel/CrudTest.php b/tests/src/Kernel/CrudTest.php --- b/tests/src/Kernel/CrudTest.php +++ b/tests/src/Kernel/CrudTest.php @@ -240,7 +240,7 @@ $job->save(); $job_item = tmgmt_job_item_create('test_source', 'test_type', 1, ['tjid' => $job->id()]); $job_item->save(); - $job_item->updateData('title', [0 => ['value' => ['#translation' => ['#text' => 'Invalid translation that will cause an exception']]]], TRUE); + $job_item->updateData(['dummy', 'deep_nesting'], ['#text' => 'Invalid translation that will cause an exception']); $job_item->save(); // Request translation. Here it fails. diff -u b/tmgmt_test/src/Plugin/tmgmt/Source/TestSource.php b/tmgmt_test/src/Plugin/tmgmt/Source/TestSource.php --- b/tmgmt_test/src/Plugin/tmgmt/Source/TestSource.php +++ b/tmgmt_test/src/Plugin/tmgmt/Source/TestSource.php @@ -101,7 +101,7 @@ public function saveTranslation(JobItemInterface $job_item, $target_langcode) { // Set a variable that can be checked later for a given job item. $data = $job_item->getData(); - if (isset($data['title'][0]['value']['#translation']['#text']) && $data['title'][0]['value']['#translation']['#text'] == 'Invalid translation that will cause an exception') { + if (isset($data['dummy']['deep_nesting']['#text']) && $data['dummy']['deep_nesting']['#text'] == 'Invalid translation that will cause an exception') { throw new \Exception('The translation cannot be saved.'); } \Drupal::state()->set('tmgmt_test_saved_translation_' . $job_item->getItemType() . '_' . $job_item->getItemId(), $job_item->getData());