Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
1. Site set as "Finnish" by default, English as another language
2. Created a store
3. Enabled translation support for the store at /admin/config/regional/content-language
4. Went to the store, store/1, click on translate tab to get to store/1/translations
5. I see that the original version of the store is in Finnish, I click on "Add" on the English row to add an English translation
6. I get following error
The website encountered an unexpected error. Please try again later.
Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException: The "commerce_store" entity type did not specify a "default" form class. in Drupal\Core\Entity\EntityTypeManager->getFormObject() (line 184 of core/lib/Drupal/Core/Entity/EntityTypeManager.php).
Drupal\Core\Entity\EntityManager->getFormObject('commerce_store', 'default') (Line: 44)
Drupal\Core\Entity\EntityFormBuilder->getForm(Object, 'default', Array) (Line: 348)
Drupal\content_translation\Controller\ContentTranslationController->add(Object, Object, Object, 'commerce_store')
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 144)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 652)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
I did also try to add a custom, translatable field for the store but I get the same error after that too. Above was with just the default fields of a store entity.
Comment | File | Size | Author |
---|---|---|---|
#5 | commerce_store_translation.patch | 662 bytes | tormu |
Comments
Comment #2
tormu CreditAttribution: tormu commentedComment #3
tormu CreditAttribution: tormu commentedChanged the version to 8.x-2.x-dev since switching to dev branch didn't offer any improvements on this.
Comment #4
bojanz CreditAttribution: bojanz commentedSide note, we need to add tests for translating all entity types, this regression happened in the past 6 months.
Comment #5
tormu CreditAttribution: tormu commentedPosting the following on behalf of @tzveto, who is having problems with posting to d.o for some reason :(
Added the core patch that we made to be able to go past the crash..
After some research this is caused by getting the "Add" translation form with operation parameter
$operation = 'default';
and no 'default' operation is set which causes the error.
In the code in `Drupal\content_translation\Controller\ContentTranslationController.php` there is a TODO linking to https://www.drupal.org/node/2006348
and adding the following fixes the store translations
Maybe this is not the proper way to fix this, because from a few other similar issues (missing form for a 'default' operation) with other modules this looks related to Drupal core entity system and I'm not aware with D8 to make changes there and if possible fix this on a more general level.
Any responds and suggestion for a better fix are appreciated.
Comment #7
bojanz CreditAttribution: bojanz commentedPushed a fix, we'll add tests separately. Thank you for reporting!