function field_test_rename_bundle in Drupal 7
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.
1 call to field_test_rename_bundle()
- FieldAttachStorageTestCase::testFieldAttachCreateRenameBundle in modules/
field/ tests/ field.test - Test field_attach_create_bundle() and field_attach_rename_bundle().
File
- modules/
field/ tests/ field_test.entity.inc, line 184 - Defines an entity type.
Code
function field_test_rename_bundle($bundle_old, $bundle_new) {
$bundles = variable_get('field_test_bundles', array(
'test_bundle' => array(
'label' => 'Test Bundle',
),
));
$bundles[$bundle_new] = $bundles[$bundle_old];
unset($bundles[$bundle_old]);
variable_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);
}
}