Set weight of a Drupal module
for setting the weight of any module, as the Drupal saying goes, there's a module for that:
http://drupal.org/project/moduleweight
You can also edit the weight in the {system} table directly (and see what other modules have been set to, sorting by the weight column in phpMyAdmin).
But what about a way to set the weight of your module inside your module with code? Of course there is:
Resolution
Adapted from the devel module which notes module weights in core as new when putting itself very last in the chain.
Your module weight should be set and not change, so this goes in the hook_install function in your example.install file, say this agaric_module.install so:
agaric_module_install {
// put hypothetical agaric module after most normal modules.
db_query("UPDATE {system} SET weight = 50 WHERE name = 'agaric_module'");
// ...
}
This is still the way for Drupal 6. See Drupal docs.
Comments
thanks!
Just what I needed!
Post new comment