Fatal error saving translation when content moderation is enabled

Created on 21 January 2022, over 2 years ago
Updated 10 May 2024, about 2 months ago

Problem/Motivation

When content moderation and content translation are enabled for a content type a fatal error is thrown when you try to save a translation.

Steps to reproduce

  • Enable content moderation and add a workflow for the content type
  • Enable content translation and follow the instructions to set up multilingual paragraphs
  • Add and save a node in the original language, then add a translation.
  • In the system messages block you will see the error Non-translatable fields can only be changed when updating the original language and the paragraph field will be hidden.
  • When you save the translation a fatal error is thrown
  • Proposed resolution

    Set the#multilingual key on the LayoutParagraphsWidget the same way as is done for ParagraphsWidget

    🐛 Bug report
    Status

    Fixed

    Version

    2.0

    Component

    Code

    Created by

    🇪🇸Spain Peacog

    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.

    • 🇨🇦Canada othermachines Edmonton, Alberta

      I wondered why paragraphs added to the layout were no longer appearing as translatable after setting up content moderation!

      This patch fixes the issue. I can translate paragraphs again. Thanks!

    • 🇮🇹Italy FiNeX

      Thank you for the patch. It works fine.

    • Thanks. I hadn't been able to upgrade because when i would go to edit the translated node, the paragraph content had completely dissapeared. This patch is working on 9.5/php8.1 with dev version of layout_paragraphs. I can now see, edit and save translated layout_paragraph content.

    • 🇮🇹Italy FiNeX

      Hi, I'm using the patch with Drupal 10.1.1, Paragraph 8.x-1.15 and Layout Paragraph 2.x-dev. Will be committed on the project? It works good. Thank you very much.

    • 🇮🇹Italy FiNeX

      I've found a minor issue: when a field inside a paragraph is marked as untranslatable, it should be hidden because what I'm experiencing now is:

      1. Create the node
      2. Translate it and edit a paragraph inside a layout paragraph. This paragraph contains an untranslatable field which is visible
      3. Change the untranslatable field value
      4. Save the paragraph: the error is triggered
      5. Undo the paragraph edit and save the node
      6. Edit again the node and change the untranslatable field, this time it works but now the two paragraph (the one in the original language and the translated one) are no more in sync.
    • I can confirm #15. I followed the steps and experienced the same results. The hidden field shows up when i go to translate the content.

    • Status changed to Needs review 11 months ago
    • First commit to issue fork.
    • @pemson18 opened merge request.
    • 🇧🇪Belgium antoineh Mechelen, 🇧🇪

      In combination with https://www.drupal.org/project/entity_reference_revisions/issues/3150084 🐛 Non-translatable fields can only be changed when updating the current revision. Needs review , the issue in #15 should be partly solved.

    • Looked at this issue (briefly) again today.

      It looks like the the "untranslateable field" value can be edited but not actually saved, no matter how many times i tried, which is good! The field is still visible though. I should also note that i was not able to reproduce step 6 from #15 anymore, but i used to be able to. Weird.

      I couldn't discern any changes after appling the patch referenced in #20 to entity_reference_revisions. Field is still visible and still unable to save. I might be missing something that it's doing though.

    • Open in Jenkins → Open on Drupal.org →
      Core: 10.2.x + Environment: PHP 8.1 & MariaDB 10.3.22
      last update 4 months ago
      55 pass
    • 🇧🇪Belgium antoineh Mechelen, 🇧🇪

      Added MR as patch

    • 🇺🇸United States sethhill

      Noting that this solution is the same as what's suggested at https://www.drupal.org/project/layout_paragraphs/issues/3397222 🐛 Widget is hidden if untranslatable fields are hidden Needs review , where I also updated the builder.js to pass FunctionalJavascript tests on the latest 2.0.x code. Once that is merged this should be updated as fixed as well.

    • Status changed to Fixed 2 months ago
    • Automatically closed - issue fixed for 2 weeks with no activity.

    Production build 0.69.0 2024