function field_attach_delete_bundle

×

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.attach.inc field_attach_delete_bundle($entity_type, $bundle)
cle7 field.attach.inc field_attach_delete_bundle($entity_type, $bundle)
elmsmedia7 field.attach.inc field_attach_delete_bundle($entity_type, $bundle)
icor7 field.attach.inc field_attach_delete_bundle($entity_type, $bundle)
meedjum_blog7 field.attach.inc field_attach_delete_bundle($entity_type, $bundle)
mooc7 field.attach.inc field_attach_delete_bundle($entity_type, $bundle)

Notify field.module the a bundle was deleted.

This deletes the data for the field instances as well as the field instances themselves. This function actually just marks the data and field instances and deleted, leaving the garbage collection for a separate process, because it is not always possible to delete this much data in a single page request (particularly since for some field types, the deletion is more than just a simple DELETE query).

Parameters

$entity_type: The entity type to which the bundle is bound.

$bundle: The bundle to delete.

Related topics

12 calls to field_attach_delete_bundle()
comment_node_type_delete in modules/comment/comment.module
Implements hook_node_type_delete().
comment_uninstall in modules/comment/comment.install
Implements hook_uninstall().
EntityAPIController::invoke in sites/all/modules/ulmus/entity/includes/entity.controller.inc
Implements EntityAPIControllerInterface.
EntityAPIControllerExportable::invoke in sites/all/modules/ulmus/entity/includes/entity.controller.inc
Overridden to care about reverted bundle entities and to skip Rules.
entity_test_uninstall in sites/all/modules/ulmus/entity/tests/entity_test.install
Implements hook_uninstall().

... See full list

File

modules/field/field.attach.inc, line 1394
Field attach API, allowing entities (nodes, users, ...) to be 'fieldable'.

Code

function field_attach_delete_bundle($entity_type, $bundle) {
  // First, delete the instances themselves. field_read_instances() must be
  // used here since field_info_instances() does not return instances for
  // disabled entity types or bundles.
  $instances = field_read_instances(array('entity_type' => $entity_type, 'bundle' => $bundle), array('include_inactive' => 1));
  foreach ($instances as $instance) {
    field_delete_instance($instance);
  }

  // Clear the cache.
  field_cache_clear();

  // Clear bundle display settings.
  variable_del('field_bundle_settings_' . $entity_type . '__' . $bundle);

  // Let other modules act on deleting the bundle.
  module_invoke_all('field_attach_delete_bundle', $entity_type, $bundle, $instances);
}