hook_field_storage_delete

7 field.api.php hook_field_storage_delete($entity_type, $entity, $fields)
8 field.api.php hook_field_storage_delete($entity_type, $entity, $fields)

Delete all field data for an entity.

This hook is invoked from field_attach_delete() to ask the field storage module to delete field data.

Parameters

$entity_type: The entity type of entity, such as 'node' or 'user'.

$entity: The entity on which to operate.

$fields: An array listing the fields to delete. The keys and values of the array are field IDs.

Related topics

2 functions implement hook_field_storage_delete()

1 invocation of hook_field_storage_delete()

File

modules/field/field.api.php, line 1857

Code

function hook_field_storage_delete($entity_type, $entity, $fields) {
  list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity);

  foreach (field_info_instances($entity_type, $bundle) as $instance) {
    if (isset($fields[$instance['field_id']])) {
      $field = field_info_field_by_id($instance['field_id']);
      field_sql_storage_field_storage_purge($entity_type, $entity, $field, $instance);
    }
  }
}
Login or register to post comments