function hook_entity_bundle_create

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/entity.api.php \hook_entity_bundle_create()
  2. 8.9.x core/lib/Drupal/Core/Entity/entity.api.php \hook_entity_bundle_create()
  3. 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().
4 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.
ContentEntityStorageBase::create in core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
Constructs a new entity object, without permanently saving it.
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 921

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();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.