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.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

samgreco created an issue. See original summary.

samgreco’s picture

Issue summary: View changes
samgreco’s picture

Forgot one key point. This happens when clicking on "Add Importer"

samgreco’s picture

Status: Active » Closed (works as designed)

Sorry. Enabled language modules and all is well.

firfin’s picture

Priority: Normal » Major
Status: Closed (works as designed) » Active

Enabling 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

firfin’s picture

That 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

firfin’s picture

Priority: Major » Critical

No workaround so critical, renders module unusable.

droath’s picture

Background

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.

firfin’s picture

Priority: Critical » Major

Enabling 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.

firfin’s picture

Priority: Major » Normal

boromino made their first commit to this issue’s fork.

jurgenhaas made their first commit to this issue’s fork.

jurgenhaas’s picture

Status: Active » Needs review

Because 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 EntityImportSourceManager of 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.

boromino’s picture

I 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.

tobiasb’s picture

Status: Needs review » Closed (outdated)

The 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.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

tobiasb changed the visibility of the branch 3061935-fatal-error-trait to hidden.

jurgenhaas changed the visibility of the branch 3061935-fix-without-content-language to active.

jurgenhaas’s picture

Status: Closed (outdated) » Active

This is still required for Drupal 10. The core fix is only available in Drupal 11. I've rebased the MR.

  • tobiasb committed a6a068ae on 8.x-1.x authored by jurgenhaas
    [#3061935] bug: Fatal error: Trait 'Drupal\content_translation\Plugin\...
tobiasb’s picture

Version: 8.x-1.0-alpha2 » 8.x-1.x-dev
Status: Active » Fixed

Thanks, committed with small changes to make PHPStan happy.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

jurgenhaas’s picture

Thank you @tobiasb, that's a smart way of doing this.

  • tobiasb committed a6a068ae on entity_import_csv-test authored by jurgenhaas
    [#3061935] bug: Fatal error: Trait 'Drupal\content_translation\Plugin\...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.