I have a custom module which is having dependency on contributed module.

How can i make sure that contributed module will be loaded before custom module ?


You could update the module weight so that it is lower than that of the contrib module meaning it would get loaded first.

  • 1
    This is only response that actually answers the asker's question. – tvanc May 20 '16 at 15:23

In your custom modules .info file add the following line.

dependencies[] = contrib-module-name

For more info refer this.

And add the module_exists condition in your code.

$module = 'required module name';
  Your Code;

Hope this will help you.

  • 1
    This doesn't make sure that a module is loaded after its dependencies; it just make sure a module is not installed/enabled if its dependencies are not enabled too. – kiamlaluno Nov 20 '15 at 6:47
  • Thnx @kiamlaluno. I updated my answer. – Abin Nov 20 '15 at 7:04
  • 1
    This still does not answer the question. – tvanc May 20 '16 at 15:22

If you need to load a specific file or function, you may include the related file using module_load_include.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.