bootstrap

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.

Drupal Bootstrap - Request Processing in Drupal

In this blog post I try to list the sequence of steps Drupal 5 takes to process an HTTP request. I have not seen it all put together in any one place. I do, however, believe that understanding the request life-cycle is crucial to grasping how a web-system works, so I hope this post will be useful to some people.

Drupal 5 uses a mechanism it calls Bootstrapping, to process an HTTP request. It is so complex that a book can easily be written about it, but that is obviously not my purpose. Therefore, I try to be laconic and concentrate on making the "diagram" rather expressive than detailed.

Disclaimer: inline comments from Drupal source code were used to compile this text.

Syndicate content