1 field_test.storage.inc field_test_field_attach_delete_bundle($entity_type, $bundle, $instances)

Implements hook_field_attach_delete_bundle().

File

core/modules/field/tests/field_test/field_test.storage.inc, line 454
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 $field_name => $instance) {
    $field = field_info_field($field_name);
    if (isset($field['storage']['type']) && $field['storage']['type'] == 'field_test_storage') {
      $field_data = &$data[$field['field_name']];
      foreach (array('current', 'revisions') as $sub_table) {
        foreach ($field_data[$sub_table] as &$row) {
          if ($row->bundle == $bundle_old) {
            $row->deleted = TRUE;
          }
        }
      }
    }
  }

  _field_test_storage_data($data);
}