Implement graceful hook_uninstall()

Created on 9 February 2017, over 8 years ago
Updated 29 July 2025, 4 days ago

Problem/Motivation

Uninstalling module doesn't clean up any configuration:
- copy fields are not being rendered
- copy fields still exist in config of content type display
- copy fields still exist in admin view: /admin/structure/ds/fields

Steps to reproduce

After installing/enabling module:

  1. Copy a field using Display Field Copy module
  2. Go to the manage display page of your choice to display the cloned field
  3. Uninstall the module
  4. Go back to the manage display page
  5. Exception/error page is displayed (see below)
  6. Reinstall the module
  7. You can access again the faulty manage display page to fix it

Proposed resolution

- create a warning before uninstalling the module (similar to https://www.drupal.org/project/block_class β†’ see example β†’ )
- implement hook_uninstall() to clean up all config

Remaining tasks

- create a warning before uninstalling the module (similar to https://www.drupal.org/project/block_class β†’ )
- implement hook_uninstall() to clean up all config

User interface changes

- none

API changes

- none

Data model changes

-none

The website encountered an unexpected error. Try again later.

Symfony\Component\Routing\Exception\RouteNotFoundException: Route "ds.manage_display_field_copy_field" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 211 of core/lib/Drupal/Core/Routing/RouteProvider.php).
Drupal\Core\Routing\UrlGenerator->getRoute('ds.manage_display_field_copy_field') (Line: 276)
Drupal\Core\Routing\UrlGenerator->generateFromRoute('ds.manage_display_field_copy_field', Array, Array, 1) (Line: 108)
Drupal\Core\Render\MetadataBubblingUrlGenerator->generateFromRoute('ds.manage_display_field_copy_field', Array, Array, ) (Line: 765)
Drupal\Core\Url->toString() (Line: 127)
πŸ“Œ Task
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡«πŸ‡·France PhilY πŸ‡ͺπŸ‡ΊπŸ‡«πŸ‡· Paris, France

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.71.5 2024