1

i often need to change/add new behaviours to existing modules, but i don't really know what is the correct way to do this.

For example i have installed the webform module. What i need to add is this:

  • on the list of submitted forms i need a button (create user) which creates a new user using some data of the submitted form.

What should i do?

Should i change the module code or is there a way i can inject this behavior by creating a new module?

I'd like the second option more than the first, are there some tutorials on how to do this?

  • There is not a general way to change the behavior that works for everyting, as Jeremy French explained in his answer. I suggest you create a new question for your example, to get specific answers for that. – Berdir Jul 5 '11 at 17:42
  • Ok, i'll write a more specific question – Nicola Peluchetti Jul 6 '11 at 9:37
3

Most of the time you will want to try to stay away from modifying the modules directly. This can be done, but it makes it more difficult to upgrade to future versions of the module.

A lot of modules allow for modification, and Drupal itself is designed for you to be able to modify things at many stages in the process of building a page. So if you can inject functionality it is best to do so.

This isn't always possible to do in which case you can either modify your local copy of the module. Or you can create an issue on the modules issue queue with a patch, which may get picked up in a future release of the module.

How to inject behavior is a very broad subject (I am sure specifics are already answered or can be asked on this site).

Most of the time you will want to create a module, and implement hooks which will allow you to modify things.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.