W3cubDocs

/Drupal 8

function hook_entity_bundle_create

hook_entity_bundle_create($entity_type_id, $bundle)

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

Hooks
Define functions that alter the behavior of Drupal core.

File

core/lib/Drupal/Core/Entity/entity.api.php, line 753
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();
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!entity.api.php/function/hook_entity_bundle_create/8.1.x