ConfigDeleteInterface::delete should allow ConfigEntity preDelete hooks to be invoked

Created on 10 June 2021, about 3 years ago
Updated 11 May 2023, about 1 year ago

Problem/Motivation

Currently deleting a single config entity can result in the site's configuration being in an inconsistent state if it has configurations which rely on it.

Steps to reproduce

Delete a configuration like a user role with the action module enabled, the role will be removed, but the relevant action configurations will still be left in the site even though they're hard dependencies on it.

Proposed resolution

Provide a new optional parameter to the ConfigDeleteInterface::delete method, which ensures that the entity's delete hooks are ran.

I'm aware that this is a major change in behaviour, so I've made it an opt-in behaviour instead for modules which require the new functionality.

Remaining tasks

  • Provide issue fork/patch
  • Add a change notice for the API change

User interface changes

N/A

API changes

ConfigDeleteInterface::delete method definition becomes:

- public function delete($type, $name);
+ public function delete($type, $name, $entity_delete = FALSE);

Data model changes

N/A

πŸ“Œ Task
Status

Fixed

Version

2.0

Component

Base module

Created by

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024