Rabbit Hole form appears on Media Revision Delete

Created on 26 September 2024, 10 months ago

Problem/Motivation

As of Drupal Core 10.2.x Media provides a UI for viewing, reverting, and deleting revisions β†’ . On delete of a revision the rabbit hole form is appearing. This should probably be handled the same way it is handled on Node deletion where this is not shown.

I was also seeing this cause an issue where if rh_media was enabled, it prevented the deletion of any media revisions in this new UI in core.

Steps to reproduce

- Enable rh_media
- Have a media type defined (ex. image)
- Create a new media entity
- Edit that entity and ensure a new revision is created
- Edit the entity again and go to the revisions tab
- Click the delete button on the non-active revision
- On the delete confirmation screen the Rabbit Hole interface is displayed
- Clicking to confirm the deletion reloads the page and the delete is not processed

Proposed resolution

Add `revision-delete` to the `$disallowed_operations` array in `rabbit_hole.module`

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mrdrewkeller

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @mrdrewkeller
  • πŸ‡ΊπŸ‡ΈUnited States mrdrewkeller

    Patch here

  • πŸ‡ΊπŸ‡ΈUnited States mrdrewkeller
  • πŸ‡ΊπŸ‡ΈUnited States mrdrewkeller
  • Issue was unassigned.
  • Status changed to Needs review 6 months ago
  • πŸ‡ΈπŸ‡ͺSweden auth

    Rabbit hole is also active on the revision-revert operation. Attached patch handles that as well.

  • πŸ‡¦πŸ‡ΊAustralia dabbor

    You can add to the patch other Disallowed Operations like:

    • scheduled_transitions_entity_form
    • scheduled_transitions_add_form
    • book_outline
    • ... And more ...

    I'm thinking the whole disallow pattern might be wrong. And if you follow the examples bellow it seems that a different $current_operation condition should be used, chaning it
    - From: !in_array($current_operation, $disallowed_operations)
    - To: $current_operation === 'edit'

    Using Rabbit Hole on content types (media types), content instances (media instances) seems to have the "edit" operation in common:
    - $form_id is node_type_edit_form thus $current_type is node_type and $current_operation is edit
    - $form_id node_page_edit_form thus $current_type is node and $current_operation is edit.

    My questions:
    1.) Are there any other forms where we need the Rabbit Hole active?
    2.) Or rather to ask are there any other operations than edit where we need it?

Production build 0.71.5 2024