What would be best practice to modify extensions? #532
-
Hi all, I have modified a couple of extensions to my needs while the original extension name has remained the same. These changes obviously get overwritten whenever extension is updated. Question: What would be best practice to keep my changes and use updated (and improved) original extension code? One idea that came to mind: a) Copy modified extension code into a new .php file and rename it so it is still identifiable (eg: breadcrumbs.php > brdcrmbs.php). Does that make sense to you? Does that even work? Cheers, Carsten |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Hello Carsten, there are at least these four options: Option 1: Send a pull request to the responsible developer, it may or may not be accepted. Here are some tips for modifying source code:
Hope this helps and happy coding. EDIT 2023-04-18: Updated links and tips. |
Beta Was this translation helpful? Give feedback.
-
Hello Carsten, an even better practice would be to suggest your modifications as possible new features to the developers, perhaps you will then have less trouble updating your sites. 😀 Steffen |
Beta Was this translation helpful? Give feedback.
-
Hi guys, thx for your answers. This clarifies things for me! From my perspectivem my modifications would not require the creation of a new extension, for I am usually not adding much code or functionality but rather comment and replace a couple of minor things (mainly with regard to SEO or Page speed). Standing on the shoulders of giants, so to speak. Example: In toc.php, I have commented out a couple of lines to blend out 2nd/3rd level headings. And I have changed the code slightly so the numbering of the headings would not be included in the toc links. Thereforem I would refrain from creating a separate extension, but would opt for what I have initially proposed (rename locally, and check from time 2 time the original code). On top of that and in cases when there is substantial modification created, I would send a pull request and/or contact the developer. Here, I agree with you, Cheers, Carsten |
Beta Was this translation helpful? Give feedback.
-
Here are a few more tips for improving things. |
Beta Was this translation helpful? Give feedback.
Hello Carsten,
an even better practice would be to suggest your modifications as possible new features to the developers, perhaps you will then have less trouble updating your sites. 😀
But I think your strategy should be OK. I have done the same with the Feed extension and extended/renamed it for podcast publishing. I try to keep track of the original extension code and apply API and layout changes to my modified extension.
Steffen