Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Based on #47+48 of Wim Leers review of the media module #2831274-191: Bring Media entity module to core as Media module.
Problem/Motivation
The BuildForm() and SubmitForm() functions in Drupal\node\Form\DeleteMultiple are pretty complex. Other entities (for example the media entity) also need to implement similar functionality, and at the moment this could cause a fair amount of duplication.
Proposed resolution
Extract these functions to a trait or base class for other entity types to reuse.
Remaining tasks
- Determine if we want to have a trait, base class or some other way to extract this.
- Actually move the code.
Comments
Comment #2
Wim LeersComment #4
chr.fritschI would propose to move the DeleteAction, DeleteActionDeriver and DeleteMultiple classes from the contrib entity module into core to solve this.
Comment #6
chr.fritschComment #8
chr.fritschThis issue could be closed. In #2670730: Provide a delete action for each content entity type we introduced Drupal\Core\Entity\Form\DeleteMultipleForm which is already used by media, node, and comment.