I have to modify a contrib module with a custom function. In my case I can't use hooks to extend it.
Is there a best practice, for example renaming the module and placing in sites/default/modules
?
I have to modify a contrib module with a custom function. In my case I can't use hooks to extend it.
Is there a best practice, for example renaming the module and placing in sites/default/modules
?
If your addition is general and not specific to your site, you could create an issue and post a patch there.
And even if you have a site specific extension, maybe it can be solved in a way that just requires an additional hook to the contrib module itself which could be useful for other use cases as well. Then you could again create an issue for that.
What I've found useful is to add a contrib and a custom folder, or maybe a contrib-custom folder inside modules folder, there you can move the modules that you've created or contrib modified.
Additionally you need to keep track of the patch that you applied somewhere, maybe a patches folder with the .patch and a readme of the changes.
version = "[version]+[issue]-[patch]"
. E.g. version = "7.x-3.6+2606586-9"
, though this may cause it to show as having updates available, even if you're using the newest version plus a patch.
Depending on your situation, you can try creating a patch for it so that the module can still be updated and you can re-apply the patch file after updates to the module to keep your customizations.