function hook_entity_bundle_create in Drupal 8
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Entity/entity.api.php \hook_entity_bundle_create()
- 10 core/lib/Drupal/Core/Entity/entity.api.php \hook_entity_bundle_create()
Act on entity_bundle_create().
This hook is invoked after the operation has been performed.
Parameters
string $entity_type_id: The type of $entity; e.g. 'node' or 'user'.
string $bundle: The name of the bundle.
See also
Entity CRUD, editing, and view hooks
Related topics
3 functions implement hook_entity_bundle_create()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- entity_schema_test_entity_bundle_create in core/
modules/ system/ tests/ modules/ entity_schema_test/ entity_schema_test.module - Implements hook_entity_bundle_create().
- field_ui_entity_bundle_create in core/
modules/ field_ui/ field_ui.module - Implements hook_entity_bundle_create().
- jsonapi_entity_bundle_create in core/
modules/ jsonapi/ jsonapi.module - Implements hook_entity_bundle_create().
3 invocations of hook_entity_bundle_create()
- ConfigEntityStorage::_doCreateFromStorageRecord in core/
lib/ Drupal/ Core/ Config/ Entity/ ConfigEntityStorage.php - Helps create a configuration entity from storage values.
- EntityBundleListener::onBundleCreate in core/
lib/ Drupal/ Core/ Entity/ EntityBundleListener.php - Reacts to a bundle being created.
- EntityStorageBase::create in core/
lib/ Drupal/ Core/ Entity/ EntityStorageBase.php - Constructs a new entity object, without permanently saving it.
File
- core/
lib/ Drupal/ Core/ Entity/ entity.api.php, line 883 - Hooks and documentation related to entities.
Code
function hook_entity_bundle_create($entity_type_id, $bundle) {
// When a new bundle is created, the menu needs to be rebuilt to add the
// Field UI menu item tabs.
\Drupal::service('router.builder')
->setRebuildNeeded();
}