function EntityBundleListener::onBundleCreate
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Entity/EntityBundleListener.php \Drupal\Core\Entity\EntityBundleListener::onBundleCreate()
- 10 core/lib/Drupal/Core/Entity/EntityBundleListener.php \Drupal\Core\Entity\EntityBundleListener::onBundleCreate()
- 11.x core/lib/Drupal/Core/Entity/EntityBundleListener.php \Drupal\Core\Entity\EntityBundleListener::onBundleCreate()
Overrides EntityBundleListenerInterface::onBundleCreate
File
-
core/
lib/ Drupal/ Core/ Entity/ EntityBundleListener.php, line 62
Class
- EntityBundleListener
- Reacts to entity bundle CRUD on behalf of the Entity system.
Namespace
Drupal\Core\EntityCode
public function onBundleCreate($bundle, $entity_type_id) {
$this->entityTypeBundleInfo
->clearCachedBundles();
// Notify the entity storage.
$storage = $this->entityTypeManager
->getStorage($entity_type_id);
if ($storage instanceof EntityBundleListenerInterface) {
$storage->onBundleCreate($bundle, $entity_type_id);
}
// Invoke hook_entity_bundle_create() hook.
$this->moduleHandler
->invokeAll('entity_bundle_create', [
$entity_type_id,
$bundle,
]);
$this->entityFieldManager
->clearCachedFieldDefinitions();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.