function field_sql_storage_field_attach_rename_bundle
field_sql_storage_field_attach_rename_bundle($entity_type, $bundle_old, $bundle_new)
Implements hook_field_attach_rename_bundle().
File
- modules/field/modules/field_sql_storage/field_sql_storage.module, line 768
- Default implementation of the field storage API.
Code
function field_sql_storage_field_attach_rename_bundle($entity_type, $bundle_old, $bundle_new) { // We need to account for deleted or inactive fields and instances. $instances = field_read_instances(array('entity_type' => $entity_type, 'bundle' => $bundle_new), array('include_deleted' => TRUE, 'include_inactive' => TRUE)); foreach ($instances as $instance) { $field = field_info_field_by_id($instance['field_id']); if ($field['storage']['type'] == 'field_sql_storage') { $table_name = _field_sql_storage_tablename($field); $revision_name = _field_sql_storage_revision_tablename($field); db_update($table_name) ->fields(array('bundle' => $bundle_new)) ->condition('entity_type', $entity_type) ->condition('bundle', $bundle_old) ->execute(); db_update($revision_name) ->fields(array('bundle' => $bundle_new)) ->condition('entity_type', $entity_type) ->condition('bundle', $bundle_old) ->execute(); } } }
© 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/modules!field!modules!field_sql_storage!field_sql_storage.module/function/field_sql_storage_field_attach_rename_bundle/7.x