I have written a Drupal 7 module that adds about ten fields to the block administration configuration form and saves the values for those fields in its own database table. My module does not create blocks, but rather extends the functionality of any block, regardless of what module created it.
My module should delete the data in its own table when any module deletes a block from the block table. However, how would my module know when this happens? Is there a hook or other "universal" method available to know when a block has been deleted?
There isn't a hook_block_delete()
, even though there are hook_node_delete()
and hook_entity_delete()
.
I've looked at development guides about creating blocks for some clues, but none of the ones I've found give examples of how they should be deleted. I've also looked at the source code of modules that create/delete blocks, like the Views module, but I can't tell how, or if, they send a notice that they have deleted a block.