Reputation: 7894
If I wanted to extend a Joomla module, K2 for example, what is "best practices" for this?
I've come across a situation where someone has modified a 3rd party module by making changes directly to the modules source files. I spent a few years as a Drupal developer, and this is generally considered bad practice because if a critical update comes out for the module, it's difficult to implement because code hacks have to be transferred to the new update - and if you forget, your site is crash. With Drupal, you would write a new custom module and use Drupal API's "hooks" to modify the 3rd party module to do what it needs to do.
Modifying modules and components directly doesn't seem like a good idea to me - If you are a Joomla ninja and you know the Drupal way, weigh in on this, or perhaps point me to a good reference?
Thanks!
Upvotes: 1
Views: 893
Reputation: 10609
The simple answer is that it depends. In some cases, you can simply use the override system to accomplish what you are trying to do. Most every decently coded module or component will allow you to use overrides. You can get quite a lot done this way as far as layout and display code.
In other cases, you can use plugins to alter the output based on a variety of triggers. Joomla has a slew of built in triggers that are used for the plugin system. You can find a complete list of the various Joomla events here - http://docs.joomla.org/Tutorial:Plugins
Lastly, since you mentioned K2, this is a great example of an extension that was built with the intention of being extended. Not only does K2 have it's own triggers for K2 specific plugins, but it also has the ability to extend admin functionality through the use of admin plugins. This really allows you a lot of flexibility in making K2 do what ever you want it to do.
Upvotes: 1