Drupal Development: Don't Give Modules and Themes The Same Name

That about says it, doesn't it?

I was building a module for a site I'm working on, and I gave a module the same name as the current theme. One of the modules purposes was to make some blocks for the sidebar, so I included an implementation of hook_block() in the module. In Drupal development, this means you called the function modulename_block() -- if you already have a theme by this name, Drupal could also see this as themename_block(). Anyway, when I enabled the new module, all blocks on the page were gone. This is an issue other developers have seen, and the advice seems to be "don't do it".

So don't do it. I broke the block functions out into a separate module with a different name, and all was well.

Categories: 

Comments

Doug Smith

Where were you three hours ago? I discovered the same thing, in the same way. Nice to know that I'm not the only one!

Comments are closed on this post to keep spammers at bay. If you want to chime in, please email or send a tweet.