function field_purge_instance

Purges a field instance record from the database.

This function assumes all data for the instance has already been purged and should only be called by field_purge_batch().

Parameters

$instance: The instance record to purge.

Related topics

1 call to field_purge_instance()
field_purge_batch in drupal/core/modules/field/field.crud.inc
Purges a batch of deleted Field API data, instances, or fields.

File

drupal/core/modules/field/field.crud.inc, line 524
Field CRUD API, handling field and field instance creation and deletion.

Code

function field_purge_instance($instance) {

  // Notify the storage engine.
  $field = field_info_field_by_id($instance['field_id']);
  module_invoke($field['storage']['module'], 'field_storage_purge_instance', $instance);
  $state = Drupal::state();
  $deleted_instances = $state
    ->get('field.instance.deleted');
  unset($deleted_instances[$instance['uuid']]);
  $state
    ->set('field.instance.deleted', $deleted_instances);

  // Clear the cache.
  field_info_cache_clear();

  // Invoke external hooks after the cache is cleared for API consistency.
  module_invoke_all('field_purge_instance', $instance);
}