Skip to content Skip to navigation

Drupal 7 hook_block_info() and hook_block_view() Strange Behaviors

Posted by: 

If you are developing a custom module with custom blocks in Drupal 7, using hook_block_info() and hook_block_view(), and you are finding that when you make changes to the code and they don't show up in the block, or you change the name of your delta and get an "undefined variable: block" error message, despite obsessively clearing your cache and enabling/disabling the module, try this:

  • Delete all the rows in the {block} table in your database that are associated with your module.
  • DELETE FROM {block} WHERE module="modulename";