function entity_test_entity_bundle_info
Same name in other branches
- 9 core/modules/system/tests/modules/entity_test/entity_test.module \entity_test_entity_bundle_info()
- 10 core/modules/system/tests/modules/entity_test/entity_test.module \entity_test_entity_bundle_info()
- 11.x core/modules/system/tests/modules/entity_test/entity_test.module \entity_test_entity_bundle_info()
Implements hook_entity_bundle_info().
1 string reference to 'entity_test_entity_bundle_info'
- KernelTestBaseTest::testSetUp in core/
modules/ simpletest/ src/ Tests/ KernelTestBaseTest.php - Tests expected behavior of setUp().
File
-
core/
modules/ system/ tests/ modules/ entity_test/ entity_test.module, line 224
Code
function entity_test_entity_bundle_info() {
$bundles = [];
$entity_types = \Drupal::entityTypeManager()->getDefinitions();
foreach ($entity_types as $entity_type_id => $entity_type) {
if ($entity_type->getProvider() == 'entity_test' && $entity_type_id != 'entity_test_with_bundle') {
$bundles[$entity_type_id] = \Drupal::state()->get($entity_type_id . '.bundles') ?: [
$entity_type_id => [
'label' => 'Entity Test Bundle',
],
];
}
}
return $bundles;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.