Drupal core bug calling hook_entity_translation_delete may lead to data loss

Created on 24 December 2022, almost 2 years ago
Updated 15 August 2024, 4 months ago

Problem/Motivation

I just opened πŸ› Creating a new translation may delete translations with drafts Fixed to document a couple of issues with content moderation and translations. I found those issues in the process of debugging why paragraphs were getting deleted from drafts. This module deletes paragraphs by implements hook_entity_translation_delete() which may be called unexpectedly due to that linked bug.

Steps to reproduce

- Install Drupal with standard profile and enable content translation and content moderation
- Enable 2 additional languages: Spanish and French
- Add the default "editorial" workflow to the "Basic page" content type and enable translation
- Configure a paragraphs field to use paragraphs_asymmetric_translation_widgets and add a paragraph with body field
- Create a new published node in English with a paragraph, body "English"
- Create a new published translation in Spanish with the paragraph body "Spanish"
- Add a new draft of the Spanish translation with the paragraph body "Spanish draft"
- Add some debug information (a breakpoint, dblog message, etc) to content_moderation_entity_delete() to inspect the entity being passed in
- Add a new draft French translation (any body)
- Visit or edit the Spanish translation; the paragraph will be removed.

Proposed resolution

I'm not sure this is something that can be fixed from this module, I don't see an obvious way to tell if hook_entity_translation_delete is being called correctly or not. Maybe this is just a documentation task, saying that developers may wish to remove paragraphs_asymmetric_translation_widgets_entity_translation_delete using hook_module_implements_alter.

Remaining tasks

TBD

User interface changes

TBD

API changes

TBD

Data model changes

TBD

πŸ’¬ Support request
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States dabblela

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