function field_purge_field

field_purge_field(FieldConfigInterface $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

$field: The field record to purge.

Related topics

Field API bulk data deletion
Cleans up after Field API bulk deletion operations.

File

core/modules/field/field.purge.inc, line 140
Provides support for field data purge after mass deletion.

Code

function field_purge_field(FieldConfigInterface $field) {
  $state = \Drupal::state();
  $deleted_fields = $state->get('field.field.deleted');
  unset($deleted_fields[$field->uuid()]);
  $state->set('field.field.deleted', $deleted_fields);

  // Invoke external hooks after the cache is cleared for API consistency.
  \Drupal::moduleHandler()->invokeAll('field_purge_field', array($field));
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!field!field.purge.inc/function/field_purge_field/8.1.x