Problem/Motivation

Translatiion support (scheduling revisions per language) was added in #3022681: Add option to schedule a transition for a specific translation but when a transition is scheduled for a certain langauage and that translation is deleted (not the whole entity, just the translation) the related scheduled translation does not get deleted.

This will result in a lot of cron errors when Drupal tries to process the transition:

LogicException: The default translation flag cannot be changed (nl).

Reproduce:

  • Create a node and translate into second language
  • Create a scheduled revision in the second language
  • Delete the _translation_ (not the node)
  • Verify that scheduled transition still exists at /admin/content/scheduled-transitions

Proposed resolution

There already are a bunch of common hooks for entity and revision deletion but none for translation deletion.

Implement hook_entity_translation_delete.

Remaining tasks

Write patch, review, commit.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

Scheduled translation for a specific language are now deleted when the translation is deleted.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

askibinski created an issue. See original summary.

askibinski’s picture

Status: Active » Needs work
FileSize
2.07 KB

Patch with hook, still needs test.

jibran’s picture

Status: Needs work » Needs review
Issue tags: +Needs tests

Let's add some tests.

askibinski’s picture

FileSize
5.45 KB
3.27 KB

The interdiff contains the test and a small copy/paste fix for a different test I found.

jibran’s picture

Nice work. The test looks good. Uploading the interdiff from #4 as a test only patch.

jibran’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs tests

Things looking good here so RTBC.

askibinski’s picture

Status: Reviewed & tested by the community » Needs work

There is an issue: isDefaultTranslation is method which is only available for entities which implement translatableInterface. However, scheduled transitions works with any entities.

askibinski’s picture

askibinski’s picture

Status: Needs work » Needs review
dpi’s picture

Status: Needs review » Fixed

Thanks for the patch @askibinski, and to @jibran for reviews and keeping queue in check :)

  • dpi committed 842081d on 8.x-1.x authored by askibinski
    Issue #3088068 by askibinski, jibran: Transition for specific language...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.