In order to have a better understanding of what Drupal does, I need to find out what the order of execution of hooks and page components is.

A page layout in Drupal consists of HTML, regions, nodes, blocks, Views and ... . Every one of these components have lots of preprocess or process functions, like hook_preprocess_node. There are also template functions, theme functions and ... that are run to build the page array.

To avoid my question to be too broad, let's only talk about the hook and preprocess functions not the core functions.


  • Sorry but compiling a list of every core hook, in order of its execution (which of course can be variable depending on what's being executed), with the necessary context to make any answer useful, is much too broad for a single question. I think you suspected as much as you mentioned it in the question. Ask yourself what specific problem you're trying to solve, and ask a question about that. If you literally want to know "how Drupal works from start to finish", a single question on this site isn't the place to do it for obvious reasons; you could write a whole book on that. – Clive Jul 4 '15 at 8:41

Consider looking at the X-ray module also. From its project page:

X-ray module gives a look at the skeletal structure of a site to help developers and site builders see how things work.


  • A technical summary is added to the help above the main administrative sections. For example, blocks, content types, and menus are summarized on Structure; themes on Appearance; etc.
  • A table of permission titles matched to their permission machine names.
  • A table of most* hooks which Drupal invokes (and when they are invoked) and that are available to be implemented.
  • The function and arguments producing each page you visit, displayed on that page.
  • The form ID of every form you see, displayed on the form.
  • Does this module give me information about the order of executions? – M a m a D Jul 4 '15 at 8:10
  • No, there is no mandated "order of execution" @Drupalist. Drupal is modular, and parts of code are executed when they're needed, depending on the context of the current request. The only sensible way to ask this would be "with a default Drupal installation, no extra modules, no extra config, what is the order hooks are executed in?", and even that's way too broad to answer here. And becomes useless as soon as you enable a module or change a setting. Take the advice from above and concentrate on what you actually need to know, rather than trying to get an impossible-to-produce cheatsheet – Clive Jul 4 '15 at 8:51

Information about modules is stored in the 'system' table. You can find there 'weight' column, order of execution of all hooks and preprocess functions depends from the module weight. But it can be changed using hook_module_implements_alter function.

  • I'm talking about the default ones. specially the theme and hook functions. – M a m a D Jul 4 '15 at 6:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.