function EntityTestBundleClassHooks::entityTypeBuild
Same name and namespace in other branches
- main core/modules/system/tests/modules/entity_test_bundle_class/src/Hook/EntityTestBundleClassHooks.php \Drupal\entity_test_bundle_class\Hook\EntityTestBundleClassHooks::entityTypeBuild()
Implements hook_entity_type_build().
Attributes
#[Hook('entity_type_build')]
File
-
core/
modules/ system/ tests/ modules/ entity_test_bundle_class/ src/ Hook/ EntityTestBundleClassHooks.php, line 69
Class
- EntityTestBundleClassHooks
- Hook implementations for entity_test_bundle_class.
Namespace
Drupal\entity_test_bundle_class\HookCode
public function entityTypeBuild(array &$entity_types) : void {
// Have multiple entity types share the same class as Entity Test.
// This allows us to test that AmbiguousBundleClassException does not
// get thrown when sharing classes.
/** @var \Drupal\Core\Entity\ContentEntityType $original_type */
$cloned_type = clone $entity_types['entity_test'];
$cloned_type->set('bundle_of', 'entity_test');
$entity_types['shared_type'] = $cloned_type;
$entity_types['shared_type']->setClass(EntityTest::class);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.