function hook_field_storage_delete_instance

Act on deletion of a field instance.

This hook is invoked during the deletion of a field instance to ask the field storage module to mark all information stored for the field instance for deletion.

Parameters

$instance: The instance being deleted.

Related topics

2 functions implement hook_field_storage_delete_instance()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

field_sql_storage_field_storage_delete_instance in drupal/core/modules/field_sql_storage/field_sql_storage.module
Implements hook_field_storage_delete_instance().
field_test_field_storage_delete_instance in drupal/core/modules/field/tests/modules/field_test/field_test.storage.inc
Implements hook_field_storage_delete_instance().
1 invocation of hook_field_storage_delete_instance()
FieldInstance::delete in drupal/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/FieldInstance.php
Overrides \Drupal\Core\Entity\Entity::delete().

File

drupal/core/modules/field/field.api.php, line 1646

Code

function hook_field_storage_delete_instance($instance) {
  $field = field_info_field($instance['field_name']);
  $table_name = _field_sql_storage_tablename($field);
  $revision_name = _field_sql_storage_revision_tablename($field);
  db_update($table_name)
    ->fields(array(
    'deleted' => 1,
  ))
    ->condition('entity_type', $instance['entity_type'])
    ->condition('bundle', $instance['bundle'])
    ->execute();
  db_update($revision_name)
    ->fields(array(
    'deleted' => 1,
  ))
    ->condition('entity_type', $instance['entity_type'])
    ->condition('bundle', $instance['bundle'])
    ->execute();
}