You are here

function field_test_field_storage_delete_revision in SimpleTest 7

Implement hook_field_storage_delete_revision().

File

tests/field_test.module, line 903

Code

function field_test_field_storage_delete_revision($obj_type, $object, $fields) {
  $data = _field_test_storage_data();
  list($id, $vid, $bundle) = field_extract_ids($obj_type, $object);
  foreach ($fields as $field_id) {
    $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 && $row->revision_id == $vid) {
          unset($field_data[$sub_table][$key]);
        }
      }
    }
  }
  _field_test_storage_data($data);
}