Cloning a node with existing translations, clones all translations of the node

Created on 18 April 2019, over 5 years ago
Updated 15 September 2024, 2 months ago

On a multilingual site, when cloning a node, all existing translations of the node are cloned. For example, if we have a node with base language English that contains a translation in the French language, attempting to clone the French translation(and only the French translation) of the node into a new node, clones both the French and English translations to a new node. This poses an issue if the cloned content should exist for a chosen language, but not for all languages.

Steps to reproduce:
1.) Install/Enable Quick Node Clone module.
2.) Install/Enable Translation module.
3.) Add language to translation module aside from your default language.
4.) Create a node.
5.) Translate created node into another language aside from default language.
6.) Clone the translation of the created node.

This results in a new node in the translated language as well as the default language.

Feature request
Status

Needs review

Version

1.0

Component

Code

Created by

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

Merge Requests

Comments & Activities

Not all content is available!

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

  • 🇧🇪Belgium rp7

    With the patch in #13 some properties are cloned that shouldn't be cloned, such as the path property. This is not the case in how the module originally works. Finetuned the patch a little bit - the outcome is now more close to the original logic.

  • 🇺🇸United States Coufu

    Agreed with #11 let's make this a feature request to provide the flexibility during the cloning process while maintaining the original behavior as default. If a dev updates the module without knowing that a major change is happening in the module, it's going to cause some mass confusion to a lot of those who already rely on the feature to clone all translations along with the parent node.

  • 🇺🇸United States ThanksNeco

    Can confirm as of Jan 2024 in Drupal 10 that the Patch #14 works perfectly. Thank you so much!

  • Status changed to Needs work 10 months ago
  • 🇺🇸United States markdorison

    Please re-roll this change in a merge request so that GitLabCI tests will run against it. Thank you!

  • Status changed to Needs review 9 months ago
  • 🇮🇳India er.garg.karan Chandigarh

    This issue has been fixed with this patch.

  • 🇪🇬Egypt omnia.ibrahim

    Patches are not working with dev version or version 1.18.0

  • 🇺🇦Ukraine Vadym.Tseiko

    Re-roll patch #18, so it can be comaptible with version 1.18.0

  • 🇧🇪Belgium falc0

    Rerolled #14 to work with latest version.
    I saw a lot of added changes to the patches in #18 and #20. Not sure if these are needed and they where not applying.

  • 🇧🇪Belgium falc0

    Made a mistake in #21, updated.

  • First commit to issue fork.
  • 🇩🇰Denmark bartvig

    My issue is that when the translations are also cloned, they keep the owner and date. This can prevent an editor from removing unwanted translations.

    Also, if the editor doesn't have access to edit or delete content in specific languages, this can pose a problem, but that's a different issue.

    I have attached a patch that makes sure that all cloned translations have the same uid, created, changed, and revision_timestamp as the cloned original language.

  • 🇩🇪Germany sandro_pagliara

    Unfortunately, we still have the following problem:

    If the cloned translation, e.g. EN, is adjusted in the Layout Builder and you then call up the original translation in the Layout Builder, the text of the cloned translation is displayed in the editor (see image ).

    This only happens in the translation. This error does not occur in the original language.

    Does anyone have an idea what could be causing this? It would be great if we could solve the problem.

  • 🇫🇷France duaelfr Montpellier, France

    Thank you for opening and working on this issue.
    I have a use case where translations are automatically generated by TMGMT but as the module clones both the orignal node and its translations, these do not trigger the TMGMT job as it considers the entity as already translated.

    Having a global configuration like suggested above seem to be a good way to solve my issue.
    Patch #22 is working for me and the code looks harmless for existing projects so it shouldn't need any upgrade path.

    I think #24 has a point too but that it's a bit out of scope here. Maybe it should be addressed in another issue.

  • 🇪🇸Spain morgothz

    Re-rolled patch from #14 to work in latest version (8.x-1.18), but also adding same logic to CloneParagraphs() method.
    Without this patch, when cloning a node with translations, nested paragraphs from that node will keep the translations, not being able to edit those paragraphs, as Drupal thinks it's editing a translation instead the original node.

  • 🇪🇸Spain morgothz

    Same patch as #27, but now re-rolled to work with latest stable version (8.x-1.18). This one also includes logic in CloneParagraphs() method.

  • Merge request !35Resolve #3049127 "Cloning a node" → (Open) created by Taran2L
  • Pipeline finished with Success
    7 days ago
    Total: 196s
    #333114
  • Pipeline finished with Success
    7 days ago
    Total: 199s
    #333120
  • Pipeline finished with Canceled
    7 days ago
    Total: 127s
    #333149
  • Pipeline finished with Success
    7 days ago
    Total: 206s
    #333150
Production build 0.71.5 2024