Getting started with Drupal for GCI Students

Reads

Introduction to Drupal: This lesson discusses about Drupal, how its community works and reasons to use and contribute to Drupal.

Here is a new fact that I learned about Drupal in this lesson:

Dries Buytaert began the Drupal software as a message board in 1999, and in 2001 drupal.org was created.
Beginning back in 1999, Drupal has gained a big community support since then. Drupal powers millions of websites and has 1,050,000+ users and developers today.

(Source: http://drupalladder.org/lesson/9ee6798c-3457-4973-9576-76f4c6d79f95 )

There was some information about the functioning of Drupal community. People can chat with the community on IRC, forums and events. It was a good read with informative things about Drupal.

Getting Familiar with Drupal Code: Drupal Core contains some of the basic features of Drupal which can be further extended by using modules and themes. This was again a good read.

How GCI works?: This seemed like an outdated text. Although, since I was a GCI participant last year too, I completely understand how GCI works.


Works

Registering and Joining drupal.org:

I have been active on drupal.org since more than a year. My profile is: https://www.drupal.org/u/ragasirtahk .


Install Git:

I have been using Git since two years! Still, I took some screenshots of the steps. I am using Windows, so the steps I followed were:

  1. Download the latest version of Git for your operating system by going to http://git-scm.com/downloads.
  2. Run the installer. For Windows, you can accept the defaults as they are all reasonable. On the “Adjusting your PATH environment” screen choose “Run Git from the Windows command prompt”).
  3. To confirm Git has installed correctly, open a terminal window and at the prompt, type ‘git’ (without the quotes). A list of the most common Git commands will print to the screen. You can also type ‘git — version’, this will display the installed git version.
git — version to display the installed git version

Basics

Moving Around in the Command Line: The there are some basic commands to know, ls is used to display the contents of the directory, pwd tells the current directory, cd is used to change directory. Pressing ctrl + c cancels an action.

Basic Configuration:

  • Tell your name to Git, the name will be used in places like commits made by you. Use git config --global user.name “Your Name” for this.
  • Provide your email to Git, this too will be associated with your commits, etc. Use git config --global user.email yourname@example.com for this.
  • Set Git to use automatic line endings: git config --global core.autocrlf true.

Using Git for Drupal

Cloning Drupal Repository

Run git clone http://git.drupal.org/project/drupal.git to clone the Drupal repository. This will download the Drupal code repository. git checkout branchname is used to change branches in a cloned repository. git pull is used to download the latest changes from Drupal.org.

Downloading a Project

Navigate to a project page on Drupal and click on the version control tab on the page. Select the version of the project which matches your Drupal version. Copy the commands and execute them in the /modules directory of your Drupal installation.

Cloned the ‘Admin Toolbar’ module

There are some informational commands which are used frequently:

ls -a to list the contents of the directory
git status to view the status of files in the working directory and staging area
git branch to list, create and manage working contexts, -a shows both existing and remote tracking branches
git log to see commit logs, -3 to see the last three commit logs

Installing Drush on Windows:

I have been using Drush before doing this task! The steps for this are:

  • Install Composer, verify installation.
  • Install Drush composer global require drush/drush:8.*, verify installation.
  • Run the drush core-status command in your Drupal website directory.
Install Drush
Verify installation
drush core-status command

Install Drupal locally:

I have been using Bitnami Drupal Stack for running Drupal locally. Also, sometimes I switch to XAMPP, but IMHO Bitnami Drupal Stack is the best.

In this ladder, I found that at many places Drupal 7 was written but Drupal 8 is the latest version and the last peer review was on 23 Sep 2013. So, I concluded that the steps are outdated and decided to use the official Acquia guide for the steps required to install Acquia Dev Desktop and Drupal 8.

I uninstalled Bitnami Drupal Stack before proceeding with the installation in order to prevent any Apache local server port issues or any MySQL issues.

After installation of Acquia Dev Desktop, I chose the option to “Start from scratch…..site”. This downloaded Drupal 8 and created an environment for it to run properly. After that, I opened the local site link in my web browser and completed the installation of Drupal 8.

Here are some screenshots that I took during the installation of Acquia Dev Desktop and Drupal 8:

Installing Dev Desktop
Installing Dev Desktop
Installing Dev Desktop
Installing Dev Desktop
Splash screen of Dev Desktop
Creating a Drupal installation
Creating a Drupal installation
Installing Drupal

Get comfortable with Drupal:

I have been using Drupal since a long time and I was familiar with all the steps given below except a few.

Here again, some guides were outdated and talked about Drupal 7 instead of Drupal 8. So, I decided to find similar guides for Drupal 8.

  • For the “configuring basic site settings” steps, I used this guide.
  • For the “add content” step, I recommend this guide.
  • For the “add taxonomy” step, I used this guide and this guide.
  • The next three steps are almost the same in Drupal 8.
  • The last step i.e. “enable a different theme”, I found this guide and this guide. I installed this theme on my Drupal installation.

Here are a few screenshots that I took during these steps:

Theme installation
Adding article
Adding vocabulary
Adding term
Adding content type
Adding field
Editing field settings
Managing fields
Adding a field
Adding content
Adding bio

After completing all the steps, I decided to get back to my favourite Bitnami Drupal Stack so I uninstalled Dev Desktop and got back to a fresh install of Bitnami Drupal Stack.


Getting started in the issue queue:

I followed the guide and created this issue: https://www.drupal.org/project/1388780/issues/3016863 .


Test patches:

I had completed these steps earlier during completion of some other GCI task. Just reposting them here…

Prerequisites: Download and install this Drupal sandbox, download and install Git, some basics of using terminal and Git.

Before you begin, you can optionally run a few Git configuration commands to make Git more legible. The commands are:
git config --global color.status auto
git config --global color.branch auto
git config --global color.interactive auto
git config --global color.diff auto

Git will become more legible!
  1. Using the command line, move into the Drupal 8 sandbox you have cloned if you are not already there.
  2. Check which branch you are on with git branch
  3. If there’s not an asterisk next to 8.x, you need to check out 8.x with git checkout 8.x
  4. Review the example issue on Drupal.org and find this problem in your locally installed sandbox site.
  5. Download the patch in comment 2, which is the latest patch.
  6. In your sandbox site, go to the page where the changes will take effect by going to Content > + Add content > Article (node/add/article), and then scrolling down and clicking the URL path settings tab. The help text for that setting is what will be changing with the patch.
  7. Apply the patch by using the command git apply 1326088-rewrite-desription-for-url-alias.patch
  8. Refresh the page in your local sandbox site you have open in your browser (the node/add/* page) and confirm the issue has been resolved by seeing the help text change.
  9. Once done testing, undo the changes applied by the patch with git reset --hard
Description before the patch
Review patch using Dreditor
Apply the patch
Changes by the patch

Some More Reads

After all the above things comes two important reads, “what to do now?” and “some important things”. These both were the best reads in the complete task! Really a must read for everyone who wishes to contribute to Drupal.


Concluding

Although most of the things in this ladder were known to me, I did learn some new things as well. Taxonomy was something that I had never heard of, now, I completing understand its usage and importance. The last two reads in the ladder were really informative, I have even bookmarked them in my browser for future needs!

All in all, it was a good DrupalLadder, but, it requires some updates as at many places it discusses about Drupal 7 instead of Drupal 8.