0

I'm trying to basicly glue/patch/fix a Drupal project so that I can edit it simpler. There's too much duplicated code which I want to make into the same function.

To do this I have to, from my own knowledge, handle modules. What I'm curious about is: What is the ideal way to structure these new functions?

Should I create a module called global_fixes, or should I add new functions to the existing modules? Feel free to share your solutions if you have been given a similiar situation.

1
  • Mostly in custom, I believe May 24 '13 at 21:48
0

Assuming that you inherited the custom modules along with the site, and there is no external maintainer of those, you should refactor the modules.

For contributed modules (i.e. modules maintained - or in some cases not - at drupal.org/projects), the options are more complicated. I don't recommend creating yet another module (global_fixes) to deal with this. You'll have problems keeping this in sync with new releases of the contributed modules you feel the urge to "fix".

Instead:

  • If you're community oriented person, raise an issue in the module's project issue queue for what you consider duplicated code (or other defects). If you fix the problem yourself, make your fix a patch, and add the patch to the issue queue.

  • If you don't want the hassle of dealing with module maintainers and the community, make a local fork where you essentially turn a contributed module into a custom one, and do whatever you like with it. This also means that you will no longer be able to download improved versions of this module drupal.org/projects. You'll have to maintain it yourself (just like any other custom module).

If you want to follow the community route, you'll probably notice that not all Drupal project maintainers are prepared to resolve your issues or commit your patches in a timely manner. So if you decide to create and submit patches, I strongly recommend that you install git and maintain a local repository that let you work with the code locally (independent of the repository at Drupal.org). Just do a merge whenever there is a new commit available at the central repository.

If you're really community minded, and discover that all the fine patches you create and submit to a project's issue queue appearently fall into a black hole, you may want to read up on this: Dealing with unsupported (abandoned) projects.

1
  • I often prefer to do things on my own. Thanks for giving me an insight of the ideal workflow in Drupal contrib modules, but I think I'll be using more customs personally. May 27 '13 at 7:44

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.