On this page
function hook_field_delete_revision
hook_field_delete_revision($entity_type, $entity, $field, $instance, $langcode, &$items)Define custom revision delete behavior for this module's field types.
This hook is invoked just before the data is deleted from field storage in field_attach_delete_revision(), and will only be called for fieldable types that are versioned.
Parameters
$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.
Related topics
File
- modules/field/field.api.php, line 637
- Hooks provided by the Field module.
Code
function hook_field_delete_revision($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 file is being deleted.
    $item['file_field_name'] = $field['field_name'];
    if (file_field_delete_file($item, $field, $entity_type, $id)) {
      $items[$delta] = NULL;
    }
  }
}
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
 https://api.drupal.org/api/drupal/modules!field!field.api.php/function/hook_field_delete_revision/7.x