18.10.2016 Views

Drupal 7 Module Development

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Creating Your First <strong>Module</strong><br />

When <strong>Drupal</strong> encounters an event for which there is a hook (and there are<br />

hundreds of such events), <strong>Drupal</strong> will look through all of the modules for matching<br />

hook implementations. It will then execute each hook implementation, one after<br />

another. Once all hook implementations have been executed, <strong>Drupal</strong> will continue<br />

its processing.<br />

In the past, all <strong>Drupal</strong> hook implementations had to reside in the .module file.<br />

<strong>Drupal</strong> 7's requirements are more lenient, but in most moderately sized modules,<br />

it is still preferable to store most hook implementations in the .module file.<br />

Later in this book you will encounter cases where hook<br />

implementations belong in other files. In such cases, the reasons<br />

for organizing the module in such a way will be explained.<br />

To begin, we will create a simple .module file that contains a single hook<br />

implementation – one that provides help information.<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!