2

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 ?

3 Answers 3

2

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

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

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';
if(module_exists($module)){
  Your Code;
}

Hope this will help you.

3
  • 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.
    – apaderno
    Nov 20, 2015 at 6:47
  • Thnx @kiamlaluno. I updated my answer.
    – Abin
    Nov 20, 2015 at 7:04
  • 1
    This still does not answer the question.
    – tvanc
    May 20, 2016 at 15:22
0

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 and acknowledge you have read our privacy policy.

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