function field_delete_instance

×

Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
cis7 field.crud.inc field_delete_instance($instance, $field_cleanup = TRUE)
cle7 field.crud.inc field_delete_instance($instance, $field_cleanup = TRUE)
elmsmedia7 field.crud.inc field_delete_instance($instance, $field_cleanup = TRUE)
icor7 field.crud.inc field_delete_instance($instance, $field_cleanup = TRUE)
meedjum_blog7 field.crud.inc field_delete_instance($instance, $field_cleanup = TRUE)
mooc7 field.crud.inc field_delete_instance($instance, $field_cleanup = TRUE)

Marks a field instance and its data for deletion.

Parameters

$instance: An instance structure.

$field_cleanup: If TRUE, the field will be deleted as well if its last instance is being deleted. If FALSE, it is the caller's responsibility to handle the case of fields left without instances. Defaults to TRUE.

Related topics

6 calls to field_delete_instance()
field_attach_delete_bundle in modules/field/field.attach.inc
Notify field.module the a bundle was deleted.
field_delete_field in modules/field/field.crud.inc
Marks a field and its instances and data for deletion.
field_ui_field_delete_form_submit in modules/field_ui/field_ui.admin.inc
Form submission handler for field_ui_field_delete_form().
media_update_7016 in sites/all/modules/ulmus/media/media.install
Convert Media entities to File entities.
og_uninstall in sites/all/modules/ulmus/og/og.install
Implements hook_uninstall().

... See full list

File

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

Code

function field_delete_instance($instance, $field_cleanup = TRUE) {
  // Mark the field instance for deletion.
  db_update('field_config_instance')->fields(array('deleted' => 1))->condition('field_name', $instance['field_name'])->condition('entity_type', $instance['entity_type'])->condition('bundle', $instance['bundle'])->execute();

  // Clear the cache.
  field_cache_clear();

  // Mark instance data for deletion.
  $field = field_info_field($instance['field_name']);
  module_invoke($field['storage']['module'], 'field_storage_delete_instance', $instance);

  // Let modules react to the deletion of the instance.
  module_invoke_all('field_delete_instance', $instance);

  // Delete the field itself if we just deleted its last instance.
  if ($field_cleanup && count($field['bundles']) == 0) {
    field_delete_field($field['field_name']);
  }
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.