How To Implement Google Calendar Events Listing to Drupal Site ?

  0 comments

In a previous Responsive Web Solution developers blog post, I discussed How to Embed Google calendar in Drupal site. In this post we'll cover an alternative method in displaying listing of Events to our Drupal site. For this we are going to use GCal Events Module which will display a block of upcoming events from Google Calendar by using Google Calendar API v3.

Step 1: Enable GCal Events Module

Download GCal Events Moduleand extract it to sites/all/module and then enable it. Once you enable this module you will get "GCal Events [Block 1]" in adminstration/structure/block .

Step 2: Configure GCal Events Module

To use this module you must configure it with Google Calendar. So you need to create Google Developer ID key (if you have not) and Google API Client Library for PHP.

Get a Google Developer ID key:

  1. Navigate to https://code.google.com/apis/console.
  2. Create a project and turn on the Calendar API (agree to the TOS).
  3. Navigate to "Credentials" in the left menu under "APIs & auth".
  4. Create a new key (server key) if you don't already have one.
  5. Once it's created, it'll display on that page. Copy the "API KEY" and save it for later.

Get the Google API Client Library for PHP:

  1. Navigate to https://github.com/google/google-api-php-client and clone the master branch.
  2. Rename that cloned directory "google-api-php-client" and move it to sites/all/libraries.

Step 3: Configure your GCal Events blocks

  1. In the module configuration page(admin/config/content/gcal_events), set the number of blocks to display.
  2. Configure GCal Events [Block 1] in adminstration/structure/block
  3. Put the API Key you created into the "Developer ID" field.
  4. Get the Calendar ID and Private Key from Google Calendar and input as the calendar ID and Private ID.
  5. Set the block to an active region and save.

 

How to get Google Calendar ID:

  1. Log into your Google Calendar.
  2. Click on the "Settings" tab.
  3. Select "Calendars"
  4. Click on the calendar you want to use.
  5. In the section labeled "Calendar Address", you should see "Calendar ID". Copy and paste that ID. into the GCal Events configuration.

If you just fill in the Calendar ID, GCal Events will default to using your public calendar. Events marked as private will not show up. If you want to display your private calendar (not advised):

  1. Under the section marked "Private Address", click on XML
  2. http://www.google.com/calendar/feeds/[ Celendar ID ]/private-[PRIVATE ID ]/basic
  3. For Private ID, you are looking for the section between "private-" and "/basic"

Add new comment