Contributing to Drupal Codebase; A practical guide for Drupal Babies.

Adedapo Ajuwon
HackerNoon.com
3 min readAug 7, 2017

--

the.conversation.is.good.gginternational.net

I recently fixed address field plugin module, so I wanted to document my process, so I can always refer to it, instead of wasting time surfing the internet. This guide will help you to better understand how to contribute to the community.

What you will learn.

  1. How to report issue without getting punched in the face

2. Best practices in creating issues

Requirements

  1. You must have git installed on your local machine

2. Understand the basic commands of git(push,pull,fetch,clone)

3. You must have a drupal.org account

Before I continue with this post, some may think why should I care about a simple typo in drupal module…

Pssst, by correcting small typo, you are doing a lot to the community and this is a form of value you are providing and a sign of appreciation, aside that, you are gradually putting your name out there on the platform, making you available and giving you presence online as a drupal contributor so companies can hire you. You convinced enough right?

Okay let’s dive in.

Step1 : What do you do whenever you find a bug or typo?

Whenever you detect a blog or typo in any drupal code-base, you can help the community by reporting the issue.

Step 2: How to report bug issue

I’m just going to use my new module I just fixed as a typical example

a) Go the module page on drupal.org, in my case its https://www.drupal.org/sandbox/togbonna/2060269

b) Click on open issue and create issue

c) Specify what you doing, in my case I’m fixing all states in my country, it’s a feature request, I wanted to complete the whole state.

Note: if you are reporting and want to work on it, you can assign issue to yourself, this will notify other developers that you are working on it.

The following process is on your local machine, make sure you have git installed

Step 3: Clone the module

a) Go back to the module page and click on version control tab

b) Copy the the unique URL to clone the project to your local machine

git clone --branch 7.x-1.x https://git.drupal.org/sandbox/togbonna/2060269.git address_field_nigeria
cd address_field_nigeria

Step 4: Create a branch.

Creating a branch will help you have your own clean slate to work with.

a) Git checkout –b fix-36-states

Then you can start working on the issue, after you are done

Step 5: Rebase

Git rebase simply means, you connect back to the main tree. This help you pull any recent changes from the source file

Join back to the main tree

Step 6: Create a patch

git diff > [description]-[issue-number]-[comment-number].patch

[description]: fixed-all-36-states

[issue-number]

Issues number

The git command will create .patch file on your local machine.

Step 7: submit patch

Before submitting your patch, make sure you test the code and verify it works, after verifying, you can submit your patch and wait patiently for the maintainer/author to review it.

Pat yourself on the back, you have done a great job in adding to drupal codebase. You should talk about it on medium blog post and facebook group page

Cheers!

--

--

Adedapo Ajuwon
HackerNoon.com

DevSecOps/SRE. Building scalable infrastructures with detailed attention to security