function EntityTestHooks::entityBundleInfo
Implements hook_entity_bundle_info().
File
-
core/
modules/ system/ tests/ modules/ entity_test/ src/ Hook/ EntityTestHooks.php, line 123
Class
- EntityTestHooks
- Hook implementations for entity_test.
Namespace
Drupal\entity_test\HookCode
public function entityBundleInfo() {
$bundles = [];
$entity_types = \Drupal::entityTypeManager()->getDefinitions();
foreach ($entity_types as $entity_type_id => $entity_type) {
if ($entity_type->getProvider() == 'entity_test' && !in_array($entity_type_id, [
'entity_test_with_bundle',
'entity_test_mul_with_bundle',
], TRUE)) {
$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.