You are here

function flag_field_attach_delete_bundle in Flag 7.3

Same name and namespace in other branches
  1. 7.2 flag.module \flag_field_attach_delete_bundle()

Implements hook_field_attach_delete_bundle().

Delete any flags' applicability to the deleted bundle.

File

./flag.module, line 1292
The Flag module.

Code

function flag_field_attach_delete_bundle($entity_type, $bundle, $instances) {

  // This query can't use db_delete() because that doesn't support a
  // subquery: see http://drupal.org/node/1267508.
  db_query("DELETE FROM {flag_types} WHERE type = :bundle AND fid IN (SELECT fid FROM {flag} WHERE entity_type = :entity_type)", array(
    ':bundle' => $bundle,
    ':entity_type' => $entity_type,
  ));
}