function hook_field_storage_purge

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

\Drupal\Core\Entity\EntityInterface $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()
1 invocation of hook_field_storage_purge()

File

drupal/core/modules/field/field.api.php, line 2054

Code

function hook_field_storage_purge(\Drupal\Core\Entity\EntityInterface $entity, $field, $instance) {
  $table_name = _field_sql_storage_tablename($field);
  $revision_name = _field_sql_storage_revision_tablename($field);
  db_delete($table_name)
    ->condition('entity_type', $entity
    ->entityType())
    ->condition('entity_id', $entity
    ->id())
    ->execute();
  db_delete($revision_name)
    ->condition('entity_type', $entity
    ->entityType())
    ->condition('entity_id', $entity
    ->id())
    ->execute();
}