I presently have a need to modify some of the functionality of an existing module (`node expire` if you must know). One way to do this is to modify the source code of the module, but this is a poor choice since any updates will destroy my changes. Is there a proper way to make changes to a function in an existing module.

Thanks,
Steve

Comments

nevets’s picture

It depends on the module and what you want to do. Some modules provide their own hooks, in other cases a core hook make help but the answer would depend on what you want to modify.

steven1350’s picture

What if I want to change part of a method in that module. Far as I know, this method calls a drupal hook
`function _node_expire_form_alter_nodeform(&$ntypes, &$form, &$form_state, $form_id)`

How would I go about this?

tdimg’s picture

implement your code so that it doesn't break anything and create a patch. You then can submit an issue with that patch on the module issue queue and if it's reasonable your code will be included in the next release. if not, you should be able to re-apply the patch in the next release.