function hook_field_storage_delete

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

\Drupal\Core\Entity\EntityInterface $entity: The entity on which to operate.

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

Related topics

2 functions implement hook_field_storage_delete()

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_delete in drupal/core/modules/field_sql_storage/field_sql_storage.module
Implements hook_field_storage_delete().
field_test_field_storage_delete in drupal/core/modules/field/tests/modules/field_test/field_test.storage.inc
Implements hook_field_storage_delete().
1 invocation of hook_field_storage_delete()
field_attach_delete in drupal/core/modules/field/field.attach.inc
Deletes field data for an existing entity. This deletes all revisions of field data for the entity.

File

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

Code

function hook_field_storage_delete(\Drupal\Core\Entity\EntityInterface $entity, $fields) {
  foreach (field_info_instances($entity
    ->entityType(), $entity
    ->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, $field, $instance);
    }
  }
}