You are here

function field_test_field_storage_purge in SimpleTest 7

Implement hook_field_storage_purge().

1 call to field_test_field_storage_purge()
field_test_field_storage_delete in tests/field_test.module
Implement hook_field_storage_delete().

File

tests/field_test.module, line 883

Code

function field_test_field_storage_purge($obj_type, $object, $field, $instance) {
  $data = _field_test_storage_data();
  list($id, $vid, $bundle) = field_extract_ids($obj_type, $object);
  $field_data =& $data[$field['id']];
  foreach (array(
    'current',
    'revisions',
  ) as $sub_table) {
    foreach ($field_data[$sub_table] as $key => $row) {
      if ($row->type == $obj_type && $row->entity_id == $id) {
        unset($field_data[$sub_table][$key]);
      }
    }
  }
  _field_test_storage_data($data);
}