request

Drupal Request Handlers - Callbacks

In our recent post we tried to introduce you with the HTTP request life-cycle in Drupal. If you read the post, hopefully you have a better understanding of what stages a request goes through in Drupal. Today we will try to give a specific example of how this understanding can help you in your daily work with Drupal.

Drupal is a modular and extensible content-management system (CMS). Among other things, this also means that a typical complex web-site is built using large number of Drupal modules. Some of these modules even change each-other's functionality through the use of Hooks.

The spirit of open-source is in "hacking" (by which we mean building your work on top of other people's genius creations, not - damaging software systems) code. With a system so large and complex - how do you know which piece of code to mess with? When tweaking complex Drupal installations, more often than not, you find yourself wondering the same question:

Where is the code that renders the output for URI /xxx/yyy?

The answer to this question is non-trivial. Drupal allows any module to register callback functions for any URI or a portion of URI. For instance different functions can be handling "/rss/*" and "/rss/xml/*". Callback handlers matching more specific URIs take precedence. Handlers are registered in menu hook functions within the module source code.

Syndicate content