function field_purge_field

Same name in other branches
  1. 7.x modules/field/field.crud.inc \field_purge_field()
  2. 9 core/modules/field/field.purge.inc \field_purge_field()
  3. 8.9.x core/modules/field/field.purge.inc \field_purge_field()
  4. 10 core/modules/field/field.purge.inc \field_purge_field()

Purges a field record from the database.

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

Parameters

\Drupal\Core\Field\FieldDefinitionInterface $field: The field to purge.

Related topics

1 call to field_purge_field()
field_purge_batch in core/modules/field/field.purge.inc
Purges a batch of deleted Field API data, field storages, or fields.

File

core/modules/field/field.purge.inc, line 118

Code

function field_purge_field(FieldDefinitionInterface $field) {
    
    /** @var \Drupal\Core\Field\DeletedFieldsRepositoryInterface $deleted_fields_repository */
    $deleted_fields_repository = \Drupal::service('entity_field.deleted_fields_repository');
    $deleted_fields_repository->removeFieldDefinition($field);
    // Invoke external hooks after the cache is cleared for API consistency.
    \Drupal::moduleHandler()->invokeAll('field_purge_field', [
        $field,
    ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.