How to Reduce/Increase module's weight on the module install process?
I'm developing one custom module and I want to increase my module weight when the module is installed.
How can I achieve this? Otherwise, does anyone know in which table the module's weight is stored?
Answers 4
Use
hook_module_implements_alter()
rather than changing the module weight.Sample implementation from content_translation.module:
There's an API for this now:
You can also implement the hook as Ivan Jaros said, which allows for more fine-grained control (e.g. first for one hook, last for another, after a specific module for the third). But the module weight should work too.
If you use import/export configs, you can change module's weight in
core.extension.yml
file, number after module's name is weight.You can use the Modules weight module:
Disclosure: I'm the maintainer of the module Modules Weight.