function entity_test_delete_bundle
Same name in other branches
- 9 core/modules/system/tests/modules/entity_test/entity_test.module \entity_test_delete_bundle()
- 8.9.x core/modules/system/tests/modules/entity_test/entity_test.module \entity_test_delete_bundle()
- 10 core/modules/system/tests/modules/entity_test/entity_test.module \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'.
5 calls to entity_test_delete_bundle()
- ContentModerationStateTest::testWorkflowNonConfigBundleDependencies in core/
modules/ content_moderation/ tests/ src/ Kernel/ ContentModerationStateTest.php - Tests the content moderation workflow dependencies for non-config bundles.
- EntityAddUITest::testAddPageWithoutBundleEntities in core/
modules/ system/ tests/ src/ Functional/ Entity/ EntityAddUITest.php - Tests the add page for an entity type not using bundle entities.
- EntityBundleFieldTest::testCustomBundleFieldUsage in core/
tests/ Drupal/ KernelTests/ Core/ Entity/ EntityBundleFieldTest.php - Tests making use of a custom bundle field.
- EntityReferenceSettingsTest::testCustomTargetBundleDeletion in core/
modules/ field/ tests/ src/ Kernel/ EntityReference/ EntityReferenceSettingsTest.php - Tests that deletions of custom bundles are mirrored in field settings.
- FieldAttachStorageTest::testEntityDeleteBundle in core/
modules/ field/ tests/ src/ Kernel/ FieldAttachStorageTest.php - Tests entity_bundle_delete().
File
-
core/
modules/ system/ tests/ modules/ entity_test/ entity_test.module, line 103
Code
function entity_test_delete_bundle($bundle, $entity_type = 'entity_test') {
$bundles = \Drupal::state()->get($entity_type . '.bundles', [
$entity_type => [
'label' => 'Entity Test Bundle',
],
]);
unset($bundles[$bundle]);
\Drupal::state()->set($entity_type . '.bundles', $bundles);
\Drupal::service('entity_bundle.listener')->onBundleDelete($bundle, $entity_type);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.