What order should functions be in in a module? Or does it not matter? I couldn't find anything in the handbook (sorry [very sorry] if I missed it there, and this is a needless post).

Comments

pbull’s picture

There's no requirement that you order your functions in any particular way, but it's usually best for some kind of method. Makes for easier maintenance and keeps you sane.

I tend to order module functions like this:

  • hooks that just return a value (like hook_perm)
  • hooks that "do stuff"
  • theming functions
  • custom functions
samwilson’s picture

I'll go for a similar approach; thanks.