function field_purge_field
Same name in other branches
- 9 core/modules/field/field.purge.inc \field_purge_field()
- 8.9.x core/modules/field/field.purge.inc \field_purge_field()
- 10 core/modules/field/field.purge.inc \field_purge_field()
- 11.x core/modules/field/field.purge.inc \field_purge_field()
Purges a field record from the database.
This function assumes all instances for the field has already been purged, and should only be called by field_purge_batch().
Parameters
$field: The field record to purge.
Related topics
1 call to field_purge_field()
- field_purge_batch in modules/
field/ field.crud.inc - Purges a batch of deleted Field API data, instances, or fields.
File
-
modules/
field/ field.crud.inc, line 1004
Code
function field_purge_field($field) {
$instances = field_read_instances(array(
'field_id' => $field['id'],
), array(
'include_deleted' => 1,
));
if (count($instances) > 0) {
throw new FieldException(t('Attempt to purge a field @field_name that still has instances.', array(
'@field_name' => $field['field_name'],
)));
}
db_delete('field_config')->condition('id', $field['id'])
->execute();
// Notify the storage engine.
module_invoke($field['storage']['module'], 'field_storage_purge_field', $field);
// Clear the cache.
field_info_cache_clear();
// Invoke external hooks after the cache is cleared for API consistency.
module_invoke_all('field_purge_field', $field);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.