Closed (fixed)
Project:
Storm
Version:
6.x-1.19
Component:
Storm.module
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
5 Jan 2009 at 12:41 UTC
Updated:
30 Aug 2012 at 19:06 UTC
I experimented with extending Storm. I added a common function, storm_xx(), in storm.module and used the function in stormattribute.module. storm_extra() was not loaded when stormattribute_menu() tried to use the function. Can the load order be controlled to ensure storm.module is loaded first?
Comments
Comment #1
Roberto Gerola commented> storm_extra() was not loaded when stormattribute_menu() tried to use the function
Not sure you can do this in the hook of menu.
> Can the load order be controlled to ensure storm.module is loaded first?
Yes, take a look at the weight field in the system table.
Comment #2
peterx commentedhook_init says it is run after all modules are loaded. hook_menu does not say when it is run but it can use stuff from hook_init so hook_menu must be run after all modules are loaded. I tried the change in another module and it worked. Perhaps the problem was by my FTPing stuff the wrong way round when when I first tried the change.
The actual change is to replace the storm directory name with a string from a central function so I can change the configuration in one place. I define the function containing the string in storm.module and use the function wherever there is a path in the modules I am using. I am adding one module at a time to see what each module does.
Comment #3
drupalfever commentedI know that this post was made long ago but I am posting an answer to help out future Drupalers.
There is actually a way to request Drupal to load your module before others. You will have to change the weight of your module on the database.
The database table that you will have to alter is called "system". This table has a record of all the modules and themes that you are using on your website. You will have to change the weight of your module so it is lighter than any other module.
Following is an example of PHP code that you could put on the "storm" module that would make sure that your module is always the first to load:
The above code should be placed on the "storm_init" function in the module so it will be executed every time a new module is installed.