By nathandigriz on
Is it possible to find out the order of hooks calls when a page is called? Is there a rule or function that determines this? Is it immutable and dependable information that can used in the creation of a module?
I am asking here rather than on the mailing list or icq because I need to be able to refer back to any information given.
Comments
Order of hooks get executed
Order of hooks get executed based on the weight of the modules.
For example, i have extended a blog module and named it as custom_blog module. I had rewritten a menu hook of the blog in my custom module. Now the hook _menu will be executed by checking the weight of the modules.
If both are having the same weight then it goes from A-Z order of the modules. It meas that blog_menu gets executed first then followed by cust_blog_menu.
But if had my extended blog named as "advance_blog" then the "advance_blog_menu", is overridden by the the blog_menu.
To overcome this, we should always give the weight of the custom modules higher than that of the core modules. This can be done by manually updating it in the system table or providing an update command in your module installer file.