- Issue created by @mlncn
- Status changed to Needs review
8 months ago 3:24pm 10 April 2024 - πΊπΈUnited States mlncn Minneapolis, MN, USA
Example of usage in an
example.install
:/** * Remove ghostly remains of old 'resources' content type (renamed resource). * * Implements hook_update_N(). */ function example_update_9002() { \Drupal::service('module_installer')->install(['migration_helpers']); \Drupal::service('migration_helpers.exorcise_ghost_config_entity')->removeBundleFromFieldStorageConfig('node', 'resources'); \Drupal::service('module_installer')->uninstall(['migration_helpers']); }
- πΊπΈUnited States mlncn Minneapolis, MN, USA
Really need to stress that none of this code checks if what it is removing is safe to remove. It will totally remove a completely still-in-use set of config. That it is truly no longer of use is an exercise for the user of this code.
- πΊπΈUnited States mlncn Minneapolis, MN, USA
Two additional methods on ExorciseGhostConfigEntity:
removeFieldStorageConfig($entity_type, $bundle, $field_name)
cleanUpEmptyEntityType($entity_type)
The latter is called by
removeBundleFromFieldStorageConfig($entity_type, $bundle)
automatically.