1 field_test.entity.inc field_test_rename_bundle($bundle_old, $bundle_new)

Renames a bundle for test_entity entities.

Parameters

$bundle_old: The machine-readable name of the bundle to rename.

$bundle_new: The new machine-readable name of the bundle.

File

core/modules/field/tests/field_test/field_test.entity.inc, line 180
Defines an entity type.

Code

function field_test_rename_bundle($bundle_old, $bundle_new) {
  $bundles = state_get('field_test_bundles', array('test_bundle' => array('label' => 'Test Bundle')));
  $bundles[$bundle_new] = $bundles[$bundle_old];
  unset($bundles[$bundle_old]);
  state_set('field_test_bundles', $bundles);

  $info = field_test_entity_info();
  foreach ($info as $type => $type_info) {
    field_attach_rename_bundle($type, $bundle_old, $bundle_new);
  }
}