You are here

function commerce_delete_field in Commerce Core 7

Enables and deletes the specified field.

The normal API function for deleting fields, field_delete_field(), will not work on disabled fields. As a workaround, this function first activates the fields of the specified type and then deletes them.

Parameters

$field_name: The name of the field to enable and delete.

1 call to commerce_delete_field()
commerce_delete_fields in ./commerce.module
Enables and deletes fields of the specified type.

File

./commerce.module, line 206
Defines features and functions common to the Commerce modules.

Code

function commerce_delete_field($field_name) {

  // In case the field is inactive, first activate it and clear the field cache.
  if (commerce_activate_field($field_name)) {
    field_cache_clear();
  }

  // Delete the field.
  field_delete_field($field_name);
}