You are here

function field_test_field_attach_delete_bundle in Drupal 7

Implements hook_field_attach_delete_bundle().

File

modules/field/tests/field_test.storage.inc, line 350
Defines a field storage backend.

Code

function field_test_field_attach_delete_bundle($entity_type, $bundle, $instances) {
  $data = _field_test_storage_data();
  foreach ($instances as $instance) {
    $field = field_info_field_by_id($instance['field_id']);
    if ($field['storage']['type'] == 'field_test_storage') {
      $field_data =& $data[$field['id']];
      foreach (array(
        'current',
        'revisions',
      ) as $sub_table) {
        foreach ($field_data[$sub_table] as &$row) {
          if ($row->bundle == $bundle) {
            $row->deleted = TRUE;
          }
        }
      }
    }
  }
  _field_test_storage_data($data);
}