field_purge_data

Versions
7
field_purge_data($obj_type, $object, $field, $instance)

Purges the field data for a single field on a single pseudo-object.

This is basically the same as field_attach_delete() except it only applies to a single field. The object itself is not being deleted, and it is quite possible that other field data will remain attached to it.

Parameters

$obj_type The type of $object; e.g. 'node' or 'user'.

$object The pseudo-object 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

▾ 1 function calls field_purge_data()

field_purge_batch in modules/field/field.crud.inc
Purges a batch of deleted Field API data, instances, or fields.

Code

modules/field/field.crud.inc, line 1019

<?php
function field_purge_data($obj_type, $object, $field, $instance) {
  // Each field type's hook_field_delete() only expects to operate on a single
  // field at a time, so we can use it as-is for purging.
  $options = array('field_id' => $instance['field_id'], 'deleted' => TRUE);
  _field_invoke('delete', $obj_type, $object, $dummy, $dummy, $options);

  // Tell the field storage system to purge the data.
  module_invoke($field['storage']['module'], 'field_storage_purge', $obj_type, $object, $field, $instance);

  // Let other modules act on purging the data.
  foreach (module_implements('field_attach_purge') as $module) {
    $function = $module . '_field_attach_purge';
    $function($obj_type, $object, $field, $instance);
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.