Is there a source for information on the flow of Drupal in its doe and when/where hooks are called? Many questions are answered stating that you can use a certain hook (eg. hook_page_alter or hook_menu) to change something and the API documentation is pretty good at explaining what the hook is about, and shows locations where the hook is implemented, but not where/when the collected hook array additions and changes are applied as Drupal loads a page.

I want to uncover two things:

  1. The flow of Drupal in the code to see the locations in Core where the call to the list of modules that have implemented a hook are fired.
  2. Find a detailed diagram/explanation outlining the flow and the locations in the sequence where hooks are fired. (If it does not already exist I would like to create one.)
  • 1
    The very, very short answer: Search the Drupal core files for module_implements( and drupal_alter(...that will show you pretty much everywhere hooks are being called from the core system. This method has served me well for a long time now! – Clive Apr 13 '12 at 14:33
  • 1
    This is a rather broad question for which the only answer is the one given by @Clive. As such, it doesn't seem the question is much useful to future readers. – kiamlaluno Apr 13 '12 at 15:19
  • @kiamlaluno I am not asking someone to explain the entire process, I am asking for resources that explain it. Finding anything that gives a detailed flow has been difficult and I believe an answer to that question is more specific and potentially very useful:) – Ashlar Apr 13 '12 at 15:31
  • The answer to this question is: The resource you are looking for is the Drupal code; find any occurrence of module_implements(, module_invoke(, module_invoke_all(, and drupal_alter( in Drupal code, and you will know when hooks are invoked. This is what @Clive wrote in his comment, using different words. Why didn't he write that as answer? Because he knows such answer would not be useful to future readers. There aren't resources explaining when all the possible hooks are invoked. – kiamlaluno Apr 13 '12 at 15:46
  • 1
    Also while hooks pay a large part of things (conceptually) certain subsystems simply have a lifecycle such as the FAPI request lifecycle. Some people are interested in trying to document this, lin-clark.com/blog/…, but the answer does live in the code as @Clive mentioned. – tenken Apr 14 '12 at 4:55

Browse other questions tagged or ask your own question.