Jump to content

Extending existing modules


pleini
 Share

Recommended Posts

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

Hey, pleini!

  1. This is not about extending a class, but maybe an easier way to do what you need.
  2. 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)
  • Like 1
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...