playdewu Posted October 4, 2017 Share Posted October 4, 2017 Hi guys. I'm trying to create my first module. Can you give me advice how to check if the another module is attached to hook from my module install() function? Then if not, is possible to attach it? Link to comment Share on other sites More sharing options...
bellini13 Posted October 5, 2017 Share Posted October 5, 2017 The Module class has a function named "isRegisteredInHook", where you pass the hook name So in your install function, you can use the Module function getInstanceByName to get an instance of the other module, and then use isRegisteredInHook to see if the module is hooked $othermodule = Module::getInstanceByName('module_name'); if (!$othermodule->isRegisteredInHook('hook_name')) { //add your code to register the module to the hook, something like.... $othermodule->registerHook('hook_name'); } The above code is not tested, but should work 1 Link to comment Share on other sites More sharing options...
playdewu Posted October 5, 2017 Author Share Posted October 5, 2017 It works! Thank you so much Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now