Adhering to Drupal Coding Standards | Pixel Clever

It took me a while to realize how important Drupal coding standards are. Back when I first started programming I considered the code I wrote to be satisfactory as long as it got the job done. Since then however, thanks to one Drupal developer who put in me in my place I have come to see the light.
It wasn’t until after I changed my coding habits that I started to see why it was so important. Once you adjust yourself to the conventions such as the use of double spaces instead of tabs etc… it becomes automatic, and when you are adjusted to these conventions code by other developers is easier to read.

Security Issues

There are also security considerations that come into play when writing a module. Does the module protect against malicious code from would be hackers? If the module is written according to Drupal standards it does. If not you are opening yourself up to all sorts of problems.


Adhering to Drupal coding standards makes your site easier to theme. Modules that output html are recommended to place that output within themable functions so that they may be overridden at the theme level or from other modules. Not doing so can force developers to hack your module to get it to look the way they want it to.

Error Prevention

Finally, Drupal coding standards help prevent you from making stupid errors and typos. The people who came up with the standard layouts for arrays, functions and conditional statements knew something about programming and they understood that if a mistake can be made it probably will be.