function flag_field_attach_delete_bundle in Flag 7.2
Same name and namespace in other branches
- 7.3 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 919 - 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 {flags} WHERE content_type = :entity_type)", array(
':bundle' => $bundle,
':entity_type' => $entity_type,
));
}