Drupal.org - Contributing a Module & The Review Process
I recently went through the process of contributing my first Drupal 7 module, and while the process isn't too hard there were many things that would have been helpful to know at the start rather than finding out half way through the process. As a result of my experiences I've decided to put together this blog which covers many of the common pitfalls people run into and provides a collection of useful links to various bits of documentation on Drupal.org.
How It Works
When you first register at drupal.org you will only be able to create sandbox projects, once you've created your first sandbox project you will be able to apply for full project access. Applying for full project access means your sandbox project will have to go through a review by the community, once that's approved you will gain full project access and wont have to get any future projects reviewed.
Getting Started
The first thing you'll need is an idea of what the module you want to create will do, once you've come up with the idea check that there aren't existing modules that do the same thing and make sure what you are trying to do should be in its own module and not just part of another existing module. If your module is too similar to an existing module then your project application will be declined, and any hard work you've put into the module will have gone to waste. For more information on duplicate modules see collaboration rather than competition.
Creating a Sandbox Project
Creating a Sandbox project is fairly straight forwards, but be sure to check out tips for a great project page or for even more project page tips How to make your module description useful. Your project application may be delayed if the description of your project isn't sufficiently detailed.
When setting up Git for your new sandbox project if you follow the instructions provided you will end up with a master branch, unfortunately this isn't actually correct, Drupal requires that you work out of a major version branch (7.x-1.x for example) instead of master. You will need to change this before your project goes for review, read through Moving from a master to a major version branch to find out how to do this.
Coding Your Project
Getting your code to meet the standards expected by Drupal is quite easy, it does however involve reading through a lot of documentation, these are the bits I found most useful:
- Coding standards
- Commenting standards
- Writing secure code
- Module documentation guidelines (also see README files)
Once you've read through the above and written some code there are some handy tools available to check that your code complies with Drupal's standards:
- The Coder module which checks your module code on your local Drupal installation.
- ventral.org which can be used to test your code once it has been pushed to the repository on drupal.org.
If either of the above tools pick up any errors they will be brought up in your project application, and you will be expected to fix them however trivial they may seem.
Applying for Full Project Access
Before you apply make sure you check that the sandbox module you are going to apply with meets all of the requirements listed in the Project application checklist, also note you can only apply for full project access with one sandbox module.
When you're ready to apply for full project access read Apply for permission to create full projects for guidance. Once you've done this you will need to obtain a review bonus. Although the documentation suggests obtaining a review bonus is optional in practice, it truly isn't if you want your module to be reviewed in any sensible amount of time.
To get the review bonus you will need to review three other modules, see Review bonus for guidance on how to do this. Make sure that your review of the other modules is sufficiently detailed as your review will not be counted if it's just a copy of the results from ventral.org.
Once you have your review bonus add the tag and you should find your module being reviewed shortly after. Note though if any major issues are found you will not only have to fix them but will have to re-earn your review bonus so it's well worth reading the standards documentation etc... beforehand as it will probably save you time in the long run.
Good luck with your module!