This question already has an answer here:
Everytime I use drupal hooks I always take the custom module route and call the hooks from there. I'm basically talking about all the hooks in drupal -- hook_form_alter(), hook_page_alter(), hook_menu, hook_user(), hook_nodeapi(), hook_init, etc. etc. etc. etc.
On the other hand, I have never actually delve into writing hooks inside my template.php so I was wondering:
- If this is possible?
- Is it going to work exactly the same as it does when called in a module?
- Are all drupal functions available as well through template.php?
- Are there any notable differences in code implementation?
- In which scenario I would choose custom module over theme.php?
Please note any D6 and D7 difference.
Please advice. Thank you.