Make a special module for each Drupal site

Tags: 

One thing I've learned from my Drupal development time is that every site should have a new module created for it to house all of the small custom functions and things you'll use. Common things I've added to these per-site modules include:

  • Default views (more on those later),
  • Odd string modifications, e.g. shortening a node summary to fit a certain amount of space,
  • Hacks to modify forms in unusual ways, e.g. pre-assign taxonomy terms to simplify the editorial process,

I've found it much easier to manage these in one single module than e.g. hacking blocks with funky PHP code, etc, and you also gain the benefit of having it all in code, so you can track changes in a code versioning system like svn or git.

Bonus Tip

One final tidbit on this is to create a module "package" for all of the modules you create, i.e. add the following line to your mymodule.info file:

package = My Stuff

Now when you view the module admin page they'll all be grouped together, making them easier to find.

How to reply

Care to add your own 2 cents? Let me know via Twitter or my contact page.