function BundleClassTest::entityBundleInfoAlter
Same name and namespace in other branches
- 11.x core/tests/Drupal/KernelTests/Core/Entity/BundleClassTest.php \Drupal\KernelTests\Core\Entity\BundleClassTest::entityBundleInfoAlter()
Implements hook_entity_bundle_info_alter().
Attributes
#[Hook('entity_bundle_info_alter')]
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Entity/ BundleClassTest.php, line 411
Class
- BundleClassTest
- Tests entity bundle classes.
Namespace
Drupal\KernelTests\Core\EntityCode
public function entityBundleInfoAlter(array &$bundles) : void {
if (!$this->alterAttributeBundleInfo) {
return;
}
// The alter hooks runs after the bundle info provided by attributes is
// added, so override bundle information here so that it can be tested.
if (isset($bundles['entity_test']['subdir_bundle_class'])) {
$bundles['entity_test']['subdir_bundle_class']['class'] = SharedEntityTestBundleClassA::class;
$bundles['entity_test']['subdir_bundle_class']['label'] = 'Overridden bundle class to SharedEntityTestBundleClassA';
$bundles['entity_test']['subdir_bundle_class']['translatable'] = TRUE;
}
if (isset($bundles['entity_test']['bundle_class_b'])) {
$bundles['entity_test']['bundle_class_b']['class'] = SharedEntityTestBundleClassB::class;
$bundles['entity_test']['bundle_class_b']['label'] = 'Overridden bundle class to SharedEntityTestBundleClassB';
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.