Follow-up to #1035410: Flag any entity:

We need to generalize flag_node_type_delete() to http://api.drupal.org/api/drupal/modules!field!field.api.php/function/ho...

Special handling may be needed for nodes and comments, on the other hand, hook_field_attach_delete_bundle() may be invoked once for node and comment -- needs checking.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joachim’s picture

There's actually a bug here too:

function flag_node_type_delete($info) {
  // Remove entry from flaggable content types.
  db_delete('flag_types')->condition('type', $info->type)->execute();
}

This will remove types from flags for entities other than the current one if they happen to match.

Eg, both node and product entities have a bundle 'foo'. Both have flags. Deleting the product foo bundle will also zap the node flag's applicability to the node foo bundle.

joachim’s picture

Status: Postponed » Fixed
FileSize
930 bytes

Committed this patch.

Tested it with deleting a node type 'foo' when there's also a vocabulary 'foo' and vice versa. Will also remove the comment type from comment flags, as hook_field_attach_delete_bundle() is also invoked for comments when a node type is deleted.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.