On this page
function hook_field_storage_delete_instance
hook_field_storage_delete_instance($instance)
Act on deletion of a field instance.
This hook is invoked from field_delete_instance() to ask the field storage module to mark all information stored for the field instance for deletion.
Parameters
$instance: The instance being deleted.
Related topics
File
- modules/field/field.api.php, line 2161
- Hooks provided by the Field module.
Code
function hook_field_storage_delete_instance($instance) {
$field = field_info_field($instance['field_name']);
$table_name = _field_sql_storage_tablename($field);
$revision_name = _field_sql_storage_revision_tablename($field);
db_update($table_name)
->fields(array('deleted' => 1))
->condition('entity_type', $instance['entity_type'])
->condition('bundle', $instance['bundle'])
->execute();
db_update($revision_name)
->fields(array('deleted' => 1))
->condition('entity_type', $instance['entity_type'])
->condition('bundle', $instance['bundle'])
->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!field.api.php/function/hook_field_storage_delete_instance/7.x