function entity_test_delete_bundle

Deletes a bundle for entity_test entities.

Parameters

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'.

File

drupal/core/modules/system/tests/modules/entity_test/entity_test.module, line 116
Test module for the entity API providing several entity types for testing.

Code

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