User login


Showing hooks used

The Difficulty of Identifying All Hook Implementations

explained by Matej Midriak (wapnik):

Sorry i don't have time now to examine the code to find all those
patterns (if that's even possible without reading the entire drupal
sources), but here is one example.
In drupal_mail() function:

Where can hook implementations be placed so that they are called?

.module files or any file mentioned in the module's .info?

Excellent, excellent questions from Randy Fay:

23:30 rfay: Can anybody instruct me about where hook implementations can be placed in D7?
23:31 rfay: Can they be placed in any file listed in the info file's files[] ?

Drupal Hooks: A Brief Introduction

Hooks in Drupal are a way of triggering code to run based on naming convention.

This simple and powerful system is a key way in which you or other developers can extend Drupal.

Drupal's Enable hook can be tucked away in the .install file

A cool thing about hook_enable is that Drupal can find it in your .install file, even when the module has already been installed and you are just enabling it.

(As evidenced by implementation of hook_enable in comment.install and all over contrib dot install files.)

So you can keep it out of your main .module file and throw it in your .install file.

Drupal's hook_enable can be in .install.

Syndicate content