Deletes a bundle for entity_test entities.
string $bundle: The machine-readable name of the bundle to delete.
string $entity_type: (optional) The entity type for which the bundle is deleted. Defaults to 'entity_test'.
function entity_test_delete_bundle($bundle, $entity_type = 'entity_test') {
$bundles = Drupal::state()
->get($entity_type . '.bundles') ?: array(
'entity_test' => array(
'label' => 'Entity Test Bundle',
),
);
unset($bundles[$bundle]);
Drupal::state()
->set($entity_type . '.bundles', $bundles);
entity_invoke_bundle_hook('delete', $entity_type, $bundle);
}