function hook_field_delete


Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/
cis7 field.api.php hook_field_delete($entity_type, $entity, $field, $instance, $langcode, &$items)
cle7 field.api.php hook_field_delete($entity_type, $entity, $field, $instance, $langcode, &$items)
elmsmedia7 field.api.php hook_field_delete($entity_type, $entity, $field, $instance, $langcode, &$items)
icor7 field.api.php hook_field_delete($entity_type, $entity, $field, $instance, $langcode, &$items)
meedjum_blog7 field.api.php hook_field_delete($entity_type, $entity, $field, $instance, $langcode, &$items)
mooc7 field.api.php hook_field_delete($entity_type, $entity, $field, $instance, $langcode, &$items)

Define custom delete behavior for this module's field data.

This hook is invoked from field_attach_delete() on the module that defines a field, during the process of deleting an entity object (node, taxonomy term, etc.). It is invoked just before the data for this field on the particular entity object is deleted from field storage. Only field modules that are storing or tracking information outside the standard field storage mechanism need to implement this hook.


$entity_type: The type of $entity.

$entity: The entity for the operation.

$field: The field structure for the operation.

$instance: The instance structure for $field on $entity's bundle.

$langcode: The language associated with $items.

$items: $entity->{$field['field_name']}[$langcode], or an empty array if unset.

See also



Related topics

7 functions implement hook_field_delete()

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

entityreference_field_delete in sites/all/modules/ulmus/entityreference/entityreference.module
Implements hook_field_delete().
field_collection_field_delete in sites/all/modules/ulmus/field_collection/field_collection.module
Implements hook_field_delete().
field_test_field_delete in modules/field/tests/
Implements hook_field_delete().
file_field_delete in modules/file/
Implements hook_field_delete().
image_field_delete in modules/image/
Implements hook_field_delete().

... See full list

4 invocations of hook_field_delete()
EntityAPIController::delete in sites/all/modules/ulmus/entity/includes/
Implements EntityAPIControllerInterface.
field_attach_delete in modules/field/
Delete field data for an existing entity. This deletes all revisions of field data for the entity.
field_purge_data in modules/field/
Purges the field data for a single field on a single pseudo-entity.
node_delete_multiple in modules/node/node.module
Deletes multiple nodes.


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


function hook_field_delete($entity_type, $entity, $field, $instance, $langcode, &$items) {
  list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity);
  foreach ($items as $delta => $item) {
    // For hook_file_references(), remember that this is being deleted.
    $item['file_field_name'] = $field['field_name'];
    // Pass in the ID of the object that is being removed so all references can
    // be counted in hook_file_references().
    $item['file_field_type'] = $entity_type;
    $item['file_field_id'] = $id;
    file_field_delete_file($item, $field, $entity_type, $id);