hook_entity_bundle_delete($entity_type_id, $bundle)
Act on entity_bundle_delete().
This hook is invoked after the operation has been performed.
Parameters
string $entity_type_id: The type of entity; for example, 'node' or 'user'.
string $bundle: The bundle that was just deleted.
Related topics
- Entity CRUD, editing, and view hooks
- Hooks used in various entity operations.
- Hooks
- Define functions that alter the behavior of Drupal core.
File
- core/lib/Drupal/Core/Entity/entity.api.php, line 780
- Hooks and documentation related to entities.
Code
1 2 3 4 5 6 7 8 9 | function hook_entity_bundle_delete( $entity_type_id , $bundle ) { // Remove the settings associated with the bundle in my_module.settings. $config = \Drupal::config( 'my_module.settings' ); $bundle_settings = $config ->get( 'bundle_settings' ); if (isset( $bundle_settings [ $entity_type_id ][ $bundle ])) { unset( $bundle_settings [ $entity_type_id ][ $bundle ]); $config ->set( 'bundle_settings' , $bundle_settings ); } } |
Please login to continue.