Replicate in a different user interface language from the original language of the Entity will cause error on a multilingual site

Created on 16 November 2021, about 3 years ago
Updated 18 November 2024, about 1 month ago

Problem/Motivation

The problem occurs when the original language of entity and the user interface language of replicate are different.

ReplicateConfirmForm obtains the entity determined based on the user interface language being operated in buildForm().
SubmitForm() passes the entity obtained in buildForm() to Replicator service, then excute clone and save.

When saving, the saving entity is passed as an argument of hook_entity_insert() in other modules, instead of the entity of the original language.
Because of this, there are cases where the translated language is determined as the original language.
In this case, there will be a defference of the language between the cloned entity and the data created by hook_entity_insert() in other modules, which will cause problems.

I suggest the entity in the original language shoud be passed to the Replicator service when excuting clone and save, to slove this problem.

Steps to reproduce

  1. Install Drupal and "Demo: Umami Food Magazine", enable Replicate UI.
  2. Create article content in English.
  3. Add Spanish translation to the content.
  4. Display /admin/content with the user interface in Spanish and replicate the content.
  5. The article content is cloned normally, but the Entity of Content moderation created by hook_entity_insert() of Content moderation module is created in Spanish as the original language. The original language is different between node and the entity of Content moderation, which causes problems in other processes.
🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇯🇵Japan kazuko.murata

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024