1 field.module field_config_delete(Config $active_config)

Implements hook_config_delete().

Related topics

File

core/modules/field/field.module, line 598
Attach custom data fields to Backdrop entities.

Code

function field_config_delete(Config $active_config) {
  // This should only be called on fields that have no data at all, as fields
  // with data are prevented from deletion in field_config_delete_validate().
  $config_name = $active_config->getName();
  if (strpos($config_name, 'field.field.') === 0) {
    $field_name = $active_config->get('field_name');
    if (($field = field_read_field($field_name)) && !field_has_data($field)) {
      field_delete_field($field_name);
      // Fields are only marked for deletion. Purge to the field entirely.
      field_purge_batch(0);
    }
  }
}