Delete action only overridden on first entity type

Created on 30 January 2024, 5 months ago

Problem/Motivation

I found a small bug with the change that was made in #2831365: Make action confirm_form_route_name forms that delete entities disabled when protected β†’ , which prevents it from working on all entity types.

This break; statement causes the foreach loop to stop after the first entity type that it encounters:

https://git.drupalcode.org/project/entity_reference_integrity/-/blob/8d6...

With a breakpoint on that line and a drush cr, I can see that $definitions contains one entity:delete_action:* PER entity type. Not a single action for all entity types. For example, in farmOS I see the following actions:

  • entity:delete_action:asset
  • entity:delete_action:log
  • entity:delete_action:plan

But only the entity:delete_action:asset action is being overridden because of the break; statement.

Perhaps when this change was made originally, core did not use a deriver to create multiple action derivatives for each entity type? I didn't dig that deep. All I know is that right now (Drupal 10.2), core is deriving an action for each entity type.

Proposed resolution

Simple fix: remove the break; statement! :-)

Remaining tasks

  • Review/merge.

User interface changes

None.

API changes

None.

Data model changes

None.

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States m.stenta

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

Merge Requests

Comments & Activities

Production build 0.69.0 2024