W3cubDocs

/Drupal 8

function hook_entity_bundle_delete

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 771
Hooks and documentation related to entities.

Code

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);
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!entity.api.php/function/hook_entity_bundle_delete/8.1.x