0
votes

I wrote a Drupal 7 module which defines a new entity type with hook_entity_info() et al. and several custom field types with hook_field_info() et al. that are required by this entity. When the module is installed and enabled it is impossible to disable it because there is a circular dependency, the entity requires the fields that it defines. Is there a way around this that I'm missing? Or do I need to break this into two modules, one for the field and one for the entity?

1

1 Answers

1
votes

I think that, when you disable your module, you have to kill the instance of field on your node type before disabling it.

Try this to delete instance of fields:

$field_instance_to_delete = field_info_instance('node', $field_name, $nodetype);
field_delete_instance($field_instance_to_delete );