Review main Abandoned

80593[BUGFIX] Copied content element inherits all language

Łukasz Uznański CR 0 V 0 Normal +126 −0 updated 04/11/25, 20:53

Commit message

This patch ensures that a copied content element now inherits all language settings as intended.

I'm not entirely sure if this is the correct place to apply the fix, as there is also the fixCopyAfterDuplFields method. For tt_content, this method is set to handle colPos and sys_language_uid, which suggests that the current behavior might be intentional. However, I believe this behavior is not as intended.

The problem appears to be more systemic and may be broken by design. Currently, there is no page module view that displays "all languages" simultaneously. While it is possible to view all languages, copying an element still targets a specific language. In the list module, you can correctly insert this record and retain the sys_language_uid with a value of -1. However, this approach uses a different DataHandler method.

There are multiple ways to address this issue. I took the shortest route to create a patch, which should open a discussion on how to properly solve this. I believe this problem could be resolved in different parts of the PHP codebase. The current implementation fires DataHandler twice when copying an element: first with the "new" method and then with the "update" method, which sets the "correct" language.

Although this issue could also be addressed on the frontend with JavaScript, I believe the backend is a more appropriate place for this logic. I'm open to suggestions on how to improve this solution or to explore alternative approaches. Nonetheless, this patch provides a preliminary fix for the bug.

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 3

Review log 1216

  1. Łukasz Uznański uploaded patch set 1 08/17/23, 18:56

  2. core-ci voted on patch set 1 V +1 08/17/23, 19:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/45590

  3. Oliver Klee commented on patch set 1 08/17/23, 19:40

    Can we please cover this with (functional) tests?
  4. Łukasz Uznański commented on patch set 1 08/18/23, 09:19

    Reply

    I will add functional test to cover this, but I would like to know your opinion about this approach, because there are a lot of ways to solve this and I'm not sure If I picked best one.
  5. Benni Mack commented on patch set 1 08/18/23, 10:54

    Reply

    how about we set the languageField in the fieldArry explicitly to "-1"?
  6. Oliver Klee commented on patch set 1 08/18/23, 11:07

    Reply

    Unfortunately, I cannot comment on whether this approach is the right one - I don't know enough of the inner workings of the `DataHandler` for this. We need someone with more knowledge of this class for this.
  7. Łukasz Uznański commented on patch set 1 08/18/23, 11:57

    Reply Unresolved

    I can set this value explicitly to "-1" but in this scenario, we will update this record with the same value, or I can set it somewhere above in this method, and then this field will be automatically omitted. I think this might be a better idea than unsetting it directly. I will provide test case first, and then try to modify this behavior.
  8. Łukasz Uznański uploaded patch set 2 V +1 08/18/23, 13:55

  9. core-ci voted on patch set 2 V -1 08/18/23, 14:02 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/45605

  10. Łukasz Uznański uploaded patch set 3 V -1 08/18/23, 14:06

  11. core-ci voted on patch set 3 V +1 08/18/23, 14:13 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/45606

  12. Oliver Klee wrote 08/25/24, 10:13

    Removed cc Oliver Klee.
  13. Łukasz Uznański updated the commit message in patch set 4 V +1 08/26/24, 10:31

  14. core-ci voted on patch set 4 V -1 08/26/24, 14:00 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/64195

  15. Christian Kuhn commented on patch set 4 01/09/25, 17:01

    see related change https://review.typo3.org/c/Packages/TYPO3.CMS/+/86773: i'm not yet fully convinced this also fixes it for -1 records, but it may be.
  16. Benni Mack abandoned the change 04/11/25, 20:53

    Abandoning this change... because this alternative approach here fixes the actual problem https://review.typo3.org/c/Packages/TYPO3.CMS/+/89068 and due to lack of feedback here