function hook_entity_bundle_create

Same name and namespace 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. 11.x 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

6 functions implement hook_entity_bundle_create()

Note: the procedural functions in this list are found by pattern matching, so the list may include some functions that are not actually implementations of this hook.

EntitySchemaTestHooks::entityBundleCreate in core/modules/system/tests/modules/entity_schema_test/src/Hook/EntitySchemaTestHooks.php
Implements hook_entity_bundle_create().
entity_schema_test_entity_bundle_create in core/modules/system/tests/modules/entity_schema_test/entity_schema_test.module
Implements hook_entity_bundle_create().
FieldUiHooks::entityBundleCreate in core/modules/field_ui/src/Hook/FieldUiHooks.php
Implements hook_entity_bundle_create().
field_ui_entity_bundle_create in core/modules/field_ui/field_ui.module
Implements hook_entity_bundle_create().
JsonapiHooks::entityBundleCreate in core/modules/jsonapi/src/Hook/JsonapiHooks.php
Implements hook_entity_bundle_create().

... See full list

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 919

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.