pleini Posted July 14, 2016 Share Posted July 14, 2016 Hello, I'd like to extend an existing module, because I want to add functionality to a not hookable function. How can I achieve that my extended class is called first? Currently both modules are appearing in Setup menu, so the original one and the extended as well. I want to achieve that if I click on the original menu item, my extended class is called. Thank you for the answers! Link to comment Share on other sites More sharing options...
Ivan Gretsky Posted July 15, 2016 Share Posted July 15, 2016 Hey, pleini! This is not about extending a class, but maybe an easier way to do what you need. If you got a reasonable need to have some method hookable and a module is maintained, you can ask the author to make it hookable. All module writers I have talked to tried to help me when I asked and almost all of them were friendly doing that) 1 Link to comment Share on other sites More sharing options...
pleini Posted July 15, 2016 Author Share Posted July 15, 2016 Hi, thanks for the suggestions! I think multiple copies of the same module is not the best solution, because it's not update safe. If they release an updated version of the module, we have to create a copy again. Meanwhile I found a possible solution. They create the page for the Setup menu in the install() function of the original class. In the extended class I update the original page. $page->name = self::pageName; $page->process = $this; So the page process will be the extended class. What do you think about this solution? Link to comment Share on other sites More sharing options...
LostKobrakai Posted July 15, 2016 Share Posted July 15, 2016 Even overwriting only a single function (now rather two) is not really update save. It's less likely to change, but might still be subject to change. 1 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