function hook_field_storage_purge

7.x field.api.php hook_field_storage_purge($entity_type, $entity, $field, $instance)

Remove field storage information when field data is purged.

Called from field_purge_data() to allow the field storage module to delete field data information.

Parameters

$entity_type: The type of $entity; for example, 'node' or 'user'.

$entity: The pseudo-entity whose field data to delete.

$field: The (possibly deleted) field whose data is being purged.

$instance: The deleted field instance whose data is being purged.

Related topics

2 functions implement hook_field_storage_purge()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

field_sql_storage_field_storage_purge in drupal-7.x/modules/field/modules/field_sql_storage/field_sql_storage.module
Implements hook_field_storage_purge().
field_test_field_storage_purge in drupal-7.x/modules/field/tests/field_test.storage.inc
Implements hook_field_storage_purge().
1 invocation of hook_field_storage_purge()
field_purge_data in drupal-7.x/modules/field/field.crud.inc
Purges the field data for a single field on a single pseudo-entity.

File

drupal-7.x/modules/field/field.api.php, line 2650

Code

function hook_field_storage_purge($entity_type, $entity, $field, $instance) {
  list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity);

  $table_name = _field_sql_storage_tablename($field);
  $revision_name = _field_sql_storage_revision_tablename($field);
  db_delete($table_name)
    ->condition('entity_type', $entity_type)
    ->condition('entity_id', $id)
    ->execute();
  db_delete($revision_name)
    ->condition('entity_type', $entity_type)
    ->condition('entity_id', $id)
    ->execute();
}