function hook_entity_bundle_rename

Act on entity_bundle_rename().

This hook is invoked after the operation has been performed.

Parameters

string $entity_type: The entity type to which the bundle is bound.

string $bundle_old: The previous name of the bundle.

string $bundle_new: The new name of the bundle.

Related topics

5 functions implement hook_entity_bundle_rename()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

entity_entity_bundle_rename in drupal/core/modules/entity/entity.module
Implements hook_entity_bundle_rename().
field_entity_bundle_rename in drupal/core/modules/field/field.attach.inc
Implements hook_entity_bundle_rename().
field_sql_storage_entity_bundle_rename in drupal/core/modules/field_sql_storage/field_sql_storage.module
Implements hook_entity_bundle_rename().
field_test_entity_bundle_rename in drupal/core/modules/field/tests/modules/field_test/field_test.storage.inc
Implements hook_entity_bundle_rename().
field_ui_entity_bundle_rename in drupal/core/modules/field_ui/field_ui.module
Implements hook_entity_bundle_rename().

File

drupal/core/includes/entity.api.php, line 109
Hooks provided the Entity module.

Code

function hook_entity_bundle_rename($entity_type, $bundle_old, $bundle_new) {

  // Update the settings associated with the bundle in my_module.settings.
  $config = config('my_module.settings');
  $bundle_settings = $config
    ->get('bundle_settings');
  if (isset($bundle_settings[$entity_type][$bundle_old])) {
    $bundle_settings[$entity_type][$bundle_new] = $bundle_settings[$entity_type][$bundle_old];
    unset($bundle_settings[$entity_type][$bundle_old]);
    $config
      ->set('bundle_settings', $bundle_settings);
  }
}