Drupal Module Folder Organization

2014-07-28

Dan Slater

Drupal Module Folder Organization

Best practices for organizing Drupal module folders with custom, contrib, and features subdirectories.

Organization is important for any Drupal site larger than the simplest of blogs. It is paramount for multi-site installations.

Every site that I create in a Drupal multisite install includes the standard folders: files, modules and themes. The primary focus for organization centers on a sites module folder.

For a more complex single-site install or multi-site Drupal installations, I follow a seemingly popular convention regarding module folders; all of my sites/all/modules folders contain at least these three subfolders:

  • custom – for all of the custom modules that I write
  • contrib – for all of the contributed modules that I download from Drupal.org
  • features – for all of the features (for specific use cases) that I export with the features module

Additionally, I also include the following subfolders in my modules folders on an as needed basis:

  • dev-tools – in case I may be taking a site from development to live
  • patches – in case I have patched any of my custom modules

Whatever convention you may choose to use, organization is always better and more productive than no organization at all.