field_attach_rename_bundle

Versions
7
field_attach_rename_bundle($obj_type, $bundle_old, $bundle_new)

Notify field.module that a bundle was renamed.

Parameters

$obj_type The object type to which the bundle is bound.

$bundle_old The previous name of the bundle.

$bundle_new The new name of the bundle.

Related topics

▾ 4 functions call field_attach_rename_bundle()

comment_node_type_update in modules/comment/comment.module
Implement hook_node_type_update().
field_test_rename_bundle in modules/field/tests/field_test.entity.inc
Renames a bundle for test_entity objects.
node_type_save in modules/node/node.module
Saves a node type to the database.
taxonomy_form_vocabulary_submit in modules/taxonomy/taxonomy.admin.inc
Accept the form submission for a vocabulary and save the results.

Code

modules/field/field.attach.inc, line 1314

<?php
function field_attach_rename_bundle($obj_type, $bundle_old, $bundle_new) {
  db_update('field_config_instance')
    ->fields(array('bundle' => $bundle_new))
    ->condition('object_type', $obj_type)
    ->condition('bundle', $bundle_old)
    ->execute();

  // Clear the cache.
  field_cache_clear();

  // Let other modules act on renaming the bundle.
  module_invoke_all('field_attach_rename_bundle', $obj_type, $bundle_old, $bundle_new);
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.