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.
Comment | File | Size | Author |
---|---|---|---|
#8 | interdiff_4_8.txt | 997 bytes | askibinski |
#8 | 3088068-8.patch | 5.97 KB | askibinski |
| |||
#4 | 3088068-4.patch | 5.45 KB | askibinski |
|
Comments
Comment #2
askibinski CreditAttribution: askibinski for Erasmus University Rotterdam commentedPatch with hook, still needs test.
Comment #3
jibranLet's add some tests.
Comment #4
askibinski CreditAttribution: askibinski at iO for Erasmus University Rotterdam commentedThe interdiff contains the test and a small copy/paste fix for a different test I found.
Comment #5
jibranNice work. The test looks good. Uploading the interdiff from #4 as a test only patch.
Comment #6
jibranThings looking good here so RTBC.
Comment #7
askibinski CreditAttribution: askibinski at iO for Erasmus University Rotterdam commentedThere is an issue:
isDefaultTranslation
is method which is only available for entities which implementtranslatableInterface
. However, scheduled transitions works with any entities.Comment #8
askibinski CreditAttribution: askibinski at iO for Erasmus University Rotterdam commentedComment #9
askibinski CreditAttribution: askibinski at iO for Erasmus University Rotterdam commentedComment #10
dpiThanks for the patch @askibinski, and to @jibran for reviews and keeping queue in check :)