1

I'm not looking for hook_enable (which would trigger when the module is been enable).

I have a module that would work alone (lets call it custom_module_1) and I have another module which is an add-on (lets call it custom_module_2) to that module to the custom_module_1. I want to be able to have a different behavior on the custom_module_1 if the custom_module_2 is enable.

So I'm looking for a hook that would be be using on custom_module_1 and would check if the custom_module_2 is enable.

Or how can I check if there is a module enable as a function to have a different behavior on another module ?

1 Answer 1

4

module_exists($module) will do that for you. From the API:

Parameters

string $module: The name of the module (without the .module extension).

Return value

bool TRUE if the module is both installed and enabled, FALSE otherwise.

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.