Published
Wednesday, May 13, 2009 - 19:29
Written by

With CiviCRM 2.2.3 and a patch to the Drupal Date API CiviCRM will be adding integration with one more Drupal Module, Calendar. This means you will be able to display CiviCRM events in Drupal calendars and decide what events are displayed by using Views filters in the same manner as you would any View.

As with the Calendar module in Drupal the same dependencies exist meaning the latest version of the following modules must be installed; Views, Date API and Calendar. Once you install CiviCRM and the other modules a disabled CiviCRM events view, formatted as a calendar, will be available under Site Building | Views. You will need to enable this calendar, at which point a calendar will be available at http://www.example.com/events. As with the Calendar module the best practice is to clone the default CiviCRM events calendar in order to create any custom Calendars, be sure to change the patch on the new calendar:).

There is one thing to note, you will not be able to display both CiviCRM Events and Drupal Nodes in the same Calendar. The data for the two comes from different base tables.

If you are on 2.2.2 you will need to do some patching which is covered in this forum post, http://forum.civicrm.org/index.php/topic,6320.0.html and in this Drupal issue comment http://drupal.org/node/385880#comment-1545416. Until the patch to the Date API is accepted (assuming it is) you will need to edit the Drupal Date API.

Update: The above patch to the Drupal Date Module will be a part of the 6.2.3 version. As of June 8th it's part of the Dev version.

Update #2:
The set-up of the date_api_argument_handler in the Date API changed as of version 6.2.2 of the Date API Drupal module. This patch, http://issues.civicrm.org/jira/browse/CRM-4760, to civicrm.views.inc allows for that change and adapts the view integration modules of CiviCRM to that change.

Without this patch the Date APi 6.2.2+ prevents you from choosing between the different fields in the civicrm_event table to use as the argument for the calendar. Though the default view's set-up still works, which uses civicrm_event.start_date. This patch once again allows you to choose between the four date fields in civicrm_event( Start Date, End Date, Registration Start Date & Registration End Date) while using the newest versions of the Date API 6.2.2+

This also means that the Date API integration has the following requirements:
CivicRM < 2.2.3 has no integration with Date API
CiviCRM 2.2.3+ -2.2.7 uses the code in Date API 6.2.1 with the patch to Date API outlined here http://drupal.org/node/453688.
CiviCRM 2.2.8+ uses Date API 6.2.1 or 6.2.2 with the patch this patch to Date API outlined here http://drupal.org/node/453688

CiviCRM 2.2.3 + will not require the Date API patch once Date API 6.2.3 is released, though the CiviCRM patch, http://issues.civicrm.org/jira/browse/CRM-4760, will still be needed to use Date API 2.2.2+ with versions of CiviCRM before 2.2.8.

In summary once Date API reaches 2.2.3 & CiviCRM 2.2.8 all will be settled. Sorry this is so painful both Views2 integration in CiviCRM and Non-CCK date fields in the DATE API are still in Development and as such are moving targets