Seeing this on 2 different sites. Both are test/dev sites. One has Ubercart and the other Commerce. The full error is:
Fatal error: Trait 'Drupal\content_translation\Plugin\migrate\source\I18nQueryTrait' not found in /home/xxxxx/xxxxx/web/core/modules/block_content/src/Plugin/migrate/source/d7/BlockCustomTranslation.php on line 19
I've disabled all unnecessary modules and still see this. And I've tried both the Alpha and Dev versions, as of today.
Any clues? I'd love to try this module and see if it helps me get my old sites migrated.
Comments
Comment #2
samgreco commentedComment #3
samgreco commentedForgot one key point. This happens when clicking on "Add Importer"
Comment #4
samgreco commentedSorry. Enabled language modules and all is well.
Comment #5
firfin commentedEnabling the Language module works.But this at least should be documented as a step during install. Or as an requirement should be inforced then too.
I can write a patch for this if enabling language module is indeed a requirement for this module. Maintainer feedback please
This bug renders this module unusable, but there is a workaround so unsure about priority.
Leaving my complete error here so people can find it when they run into it:
Fatal error: Trait 'Drupal\content_translation\Plugin\migrate\source\I18nQueryTrait' not found in
[my-dir]/core/modules/block_content/src/Plugin/migrate/source/d7/BlockCustomTranslation.php on line 19
Comment #6
firfin commentedThat was not the answer for me (enabling Language), still gettting same error (see below) when pressing add importer.
Will investigate further.
Error:
Fatal error: Trait 'Drupal\content_translation\Plugin\migrate\source\I18nQueryTrait' not found in /app/web/core/modules/block_content/src/Plugin/migrate/source/d7/BlockCustomTranslation.php on line 19 Call Stack: 0.0002 408920
1. {main}() /app/web/index.php:0 0.0015 603112
2. Drupal\Core\DrupalKernel->handle() /app/web/index.php:19 0.0066 1866648
3. Stack\StackedHttpKernel->handle() /app/web/core/lib/Drupal/Core/DrupalKernel.php:693 0.0066 1866648
4. Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() /app/vendor/stack/builder/src/Stack/StackedHttpKernel.php:23 0.0066 1867344
5. Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() /app/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php:52 0.0066 1867344
6. Drupal\page_cache\StackMiddleware\PageCache->handle() /app/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php:47 0.0067 1869960
7. Drupal\page_cache\StackMiddleware\PageCache->pass() /app/web/core/modules/page_cache/src/StackMiddleware/PageCache.php:85 0.0067 1869960
8. Drupal\Core\StackMiddleware\KernelPreHandle->handle() /app/web/core/modules/page_cache/src/StackMiddleware/PageCache.php:106 0.0083 2362736
9. Drupal\Core\StackMiddleware\Session->handle() /app/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php:47 0.0095 2462352 10. Symfony\Component\HttpKernel\HttpKernel->handle() /app/web/core/lib/Drupal/Core/StackMiddleware/Session.php:57 0.0095 2462768 11. Symfony\Component\HttpKernel\HttpKernel->handleRaw() /app/vendor/symfony/http-kernel/HttpKernel.php:68 0.8307 9124096
12. Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() /app/vendor/symfony/http-kernel/HttpKernel.php:151 0.8307 9124096
13. Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php:97 0.8307 9126632
14. Drupal\Core\Render\Renderer->executeInRenderContext() /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php:124 0.8307 9126984
15. Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() /app/web/core/lib/Drupal/Core/Render/Renderer.php:582 0.8307 9126984
16. call_user_func_array:{/app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php:123}() /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php:123 0.8307 9127392
17. Drupal\Core\Entity\HtmlEntityFormController->getContentResult() /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php:123 0.8314 9242600
18. Drupal\Core\Form\FormBuilder->buildForm() /app/web/core/lib/Drupal/Core/Controller/FormController.php:93 0.8314 9242728
19. Drupal\Core\Form\FormBuilder->retrieveForm() /app/web/core/lib/Drupal/Core/Form/FormBuilder.php:276 0.8315 9246128
20. call_user_func_array:{/app/web/core/lib/Drupal/Core/Form/FormBuilder.php:519}() /app/web/core/lib/Drupal/Core/Form/FormBuilder.php:519 0.8315 9246536
21. Drupal\entity_import\Form\EntityImporterForm->buildForm() /app/web/core/lib/Drupal/Core/Form/FormBuilder.php:519 0.8317 9247016
22. Drupal\entity_import\Form\EntityImporterForm->form() /app/web/core/lib/Drupal/Core/Entity/EntityForm.php:117 0.8318 9318944
23. Drupal\entity_import\Form\EntityImporterForm->getSourceOptions() /app/web/modules/contrib/entity_import/src/Form/EntityImporterForm.php:134 0.8318 9318944
24. Drupal\entity_import\EntityImportSourceManager->getDefinitionAsOptions() /app/web/modules/contrib/entity_import/src/Form/EntityImporterForm.php:310 0.8318 9318944
25. Drupal\entity_import\EntityImportSourceManager->getDefinitions() /app/web/modules/contrib/entity_import/src/EntityImportSourceManager.php:63 0.8434 9788424
26. is_subclass_of() /app/web/modules/contrib/entity_import/src/EntityImportSourceManager.php:84 0.8434 9788520
27. spl_autoload_call() /app/web/modules/contrib/entity_import/src/EntityImportSourceManager.php:84 0.8434 9788616
28. Symfony\Component\ClassLoader\ApcClassLoader->loadClass() /app/web/modules/contrib/entity_import/src/EntityImportSourceManager.php:84 0.8434 9789280
29. require('/app/web/core/modules/block_content/src/Plugin/migrate/source/d6/BoxTranslation.php') /app/vendor/symfony/class-loader/ApcClassLoader.php:112 0.8434 9789280
30. spl_autoload_call() /app/web/core/modules/block_content/src/Plugin/migrate/source/d6/BoxTranslation.php:15 0.8434 9789376
31. Symfony\Component\ClassLoader\ApcClassLoader->loadClass() /app/web/core/modules/block_content/src/Plugin/migrate/source/d6/BoxTranslation.php:15 0.8434 9790384
32. require('/app/web/core/modules/block_content/src/Plugin/migrate/source/d7/BlockCustomTranslation.php') /app/vendor/symfony/class-loader/ApcClassLoader.php:112
Comment #7
firfin commentedNo workaround so critical, renders module unusable.
Comment #8
droath commentedBackground
Looks like Drupal core has added additional migration source plugins, which rely on the content translation module. In the
EntityImportSourceManager::getDefinitions()method I'm iterating over all migration source plugins, which will throw an error if the content translation module is not enabled.Current Solution
Enabling the following modules using drush, solves the problem:
drush en content_translation language. Looking into an alternative solution to fix this without enabling this dependency.Comment #9
firfin commentedEnabling
content translation(which enables "Language" in turn) indeed helps alleviate this problem. It is a workaround, so changing priority.Thanks for getting back to this.
Comment #10
firfin commentedComment #14
jurgenhaasBecause we are in an environment where we can't have content_translation enabled, I've started a new merge request MR !2 which takes a different approach. May sound like a dirty hack, but so is the design of those source plugins pretty bad, that have undeclared dependencies.
What I did is in the
EntityImportSourceManagerof this module to simply load that missing trait file, which is otherwise unknown to the autoloader, while content_translation is not enabled.It does work as expected and should have no side effects.
Comment #15
boromino commentedI have opened an issue for Drupal Core to move core/modules/content_translation/src/Plugin/migrate/source/I18nQueryTrait.php to core/modules/migrate/src/Plugin/migrate/source/I18nQueryTrait.php: https://www.drupal.org/project/drupal/issues/3258581.
Comment #17
tobiasbThe issue #3258581: Move I18nQueryTrait from content_translation to migrate_drupal was fixed in Drupal core and is part of 11.2. So I think we do not need this anymore.
Comment #22
jurgenhaasThis is still required for Drupal 10. The core fix is only available in Drupal 11. I've rebased the MR.
Comment #24
tobiasbThanks, committed with small changes to make PHPStan happy.
Comment #26
jurgenhaasThank you @tobiasb, that's a smart way of doing this.