function entity_entity_bundle_delete

Implements hook_entity_bundle_delete().

File

drupal/core/modules/entity/entity.module, line 49
Manage the entity system.

Code

function entity_entity_bundle_delete($entity_type, $bundle) {
  $entity_info = entity_get_info('entity_display');

  // Remove entity displays of the deleted bundle.
  $ids = config_get_storage_names_with_prefix('entity.display.' . $entity_type . '.' . $bundle);
  foreach ($ids as &$id) {
    $id = ConfigStorageController::getIDFromConfigName($id, $entity_info['config_prefix']);
  }
  entity_delete_multiple('entity_display', $ids);

  // Remove entity form displays of the deleted bundle.
  $ids = config_get_storage_names_with_prefix('entity.form_display.' . $entity_type . '.' . $bundle);
  foreach ($ids as &$id) {
    $id = ConfigStorageController::getIDFromConfigName($id, $entity_info['config_prefix']);
  }
  entity_delete_multiple('entity_form_display', $ids);
}