Clean-up on bundle removal and module uninstall

Created on 25 May 2023, about 1 year ago
Updated 22 March 2024, 3 months ago

Problem/Motivation

When custom_elements module gets uninstalled we need to ensure all entity_ce_display entities are properly deleted. Theoretically, it must be done if config dependencies are properly set.

On bundle delete we need to delete also entity_ce_display entities for this entity/bundle. Something similar must already be implemented in core.

Proposed resolution

Check and try to reuse solutions from the core before bringing extra code to the project.

πŸ“Œ Task
Status

Fixed

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine mostepaniukvm

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

Comments & Activities

  • Issue created by @mostepaniukvm
  • Assigned to junkuncz
  • πŸ‡­πŸ‡ΊHungary junkuncz

    Are you sure we need to do anything about it? I was doing some testing and looks like entity_ce_display config object is deleted automatically during bundle delete and if I uninstall the module all related configs are removed.
    Maybe we could add a tiny snippet to hook_uninstall() to make sure all entity_ce_display configs are properly deleted. Something like this:

    . $storage = \Drupal::service('entity_type.manager')->getStorage('entity_ce_display');
      $configs = $storage->loadMultiple();
      if (!empty($configs)) {
        $storage->deelete($configs);
      }

    What do you think?

  • Issue was unassigned.
  • Status changed to Needs review 3 months ago
  • Status changed to Fixed 3 months ago
  • πŸ‡¦πŸ‡ΉAustria fago Vienna

    I don't think this is needed, if config dependencies are doing the clean-up correctly, it's fine to rely on that. Thanks for checking!

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.69.0 2024