function field_attach_delete_revision
field_attach_delete_revision($entity_type, $entity)
Delete field data for a single revision of an existing entity. The passed entity must have a revision id attribute.
Parameters
$entity_type: The type of $entity; e.g. 'node' or 'user'.
$entity: The entity with fields to save.
Related topics
File
- modules/field/field.attach.inc, line 1082
- Field attach API, allowing entities (nodes, users, ...) to be 'fieldable'.
Code
function field_attach_delete_revision($entity_type, $entity) { _field_invoke('delete_revision', $entity_type, $entity); list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity); // Collect the storage backends used by the fields in the entities. $storages = array(); foreach (field_info_instances($entity_type, $bundle) as $instance) { $field = field_info_field_by_id($instance['field_id']); $field_id = $field['id']; $storages[$field['storage']['type']][$field_id] = $field_id; } // Field storage backends delete their data. foreach ($storages as $storage => $fields) { $storage_info = field_info_storage_types($storage); module_invoke($storage_info['module'], 'field_storage_delete_revision', $entity_type, $entity, $fields); } // Let other modules act on deleting the revision. module_invoke_all('field_attach_delete_revision', $entity_type, $entity); }
© 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.attach.inc/function/field_attach_delete_revision/7.x