- Issue created by @Greg Boggs
- Status changed to Needs work
about 1 year ago 5:47pm 16 November 2023 - 🇵🇱Poland ad0z
It happens because module custom submit handler
$form['actions']['submit']['#submit'][] = [$form_mangler, 'redirectToEntityEditForm'];
is attached to entity delete form, this submit is executed afterNodeDeleteForm submitForm
so content translation does not exist anymore and it ends with exception when module tries to get translation field value here:$trigger_default_bundle_action = // Entity does not have Rabbit Hole field. !$entity->hasField(self::FIELD_NAME) // Entity has the field, but it's null (hasn't been set). || $entity->get(self::FIELD_NAME)->action == NULL // Entity has been explicitly set to use the default bundle action. || $entity->get(self::FIELD_NAME)->action == 'bundle_default';
There is
$disallowed_operations = ['delete', 'cancel', 'reset', 'layout_builder', 'replicate'];/code> list already in <code>rabbit_hole_form_alter
, I suppose we do not have to attach module's submit handler when current_operation is in the list. - last update
about 1 year ago 24 pass - last update
about 1 year ago 24 pass - last update
about 1 year ago 24 pass - Status changed to Needs review
about 1 year ago 5:49pm 16 November 2023 - Status changed to RTBC
about 1 year ago 11:33am 18 December 2023 - 🇩🇪Germany broon Potsdam
I just ran into that error while trying to delete a translation. In the system, entity_language_fallback is enabled which eventually leads to more trouble. For example, with three languages set up (EN, FR, IT) and the language fallback for IT is FR instead of the default language EN, if you try to delete the IT translation the mentioned error appears.
If the user does not read the error message and just reloads the page, the delete form submit will run again and delete the next language in the fallback chain.
Adding the patch provided by ad0z in #2 fixes the error. From a functional perspective: RTBC.
- 🇩🇪Germany akoe
Also tested the patch with Rabbit Hole 2.0.0-alpha5 and Drupal 10.2.2 and can confirm it solves the exception thrown by
ContentEntityBase->getTranslatedField()
- 🇹🇷Turkey emircan erkul Turkey
Tested, the error no longer appears but the page redirected to /delete route.
- Status changed to Needs work
10 months ago 12:14pm 26 February 2024 - 🇹🇷Turkey emircan erkul Turkey
Workaround prevents redirectToEntityEditForm function from running.
- 🇧🇪Belgium andreasderijcke Antwerpen / Gent
I'm raising this to 'major', as from my experience:
If you reload the page and accept the resubmission of the delete action, because you think the deletion failed, all translations and thus the node will be deleted.
This means content loss, and might even warrant 'critical'. - 🇵🇱Poland ad0z
@Emircan Erkul
Could you provide more information? Steps to reproduce it?
When redirectToEntityEditForm function is not executed, default Drupal behaviour redirect browser based on "destination" query parameter or entity "collection" link(when destination is not provided) or default link template(when none of them is provided). That's kinda interesting how you got redirected to delete form then.. - 🇧🇪Belgium mschudders
I've tested the patch as well and cannnot reproduce the issue of Emircan Erkul.
For me it seems to be working properly. Will test further to be sure.
- Status changed to RTBC
3 months ago 9:34am 12 September 2024 - First commit to issue fork.