Date iCal is your one-stop shop for iCal support in Drupal 7. It provides a plugin for Views to enable exporting your site's calendar as an iCal feed, and a plugin for Feeds to enable importing external iCal feeds into your site's calendar.

Installation

Please refer to the projects README for up-to-date information about dependencies and installation.

Exporting an iCal feed using Views

There are two plugins that create iCal feeds. You can use either one, though the iCal Fields plugin is a bit more versatile.

How to export an iCal feed using the iCal Entity plugin

  1. Go to the Manage Display page for the content type you want to export in an
    iCal feed. On the "Default" tab, check the box for "iCal" in the section
    titled "Use custom display settings for the following view modes", then click
    Save.
  2. Click the new "iCal" tab that now appears in the upper-right corner of the
    Manage Display page for this content type.
  3. Set up the iCal view mode to contain whatever should be exported as the
    'Description' field for the iCal feed. You can trim the text to the desired
    size, include additional information from other fields, etc.
  4. Do this for each of the content types that you wish to include in your
    site's iCal feeds.
  5. Create a new View that displays the entities that you want to include in the
    iCal feed.
  6. Add a "Feed" to the view. Change the Format to 'iCal Feed'. When you click
    Apply from that dialog, you'll be given the option to name the calendar. This
    name will appear in your users' calendar clients as the calendar's title.
  7. Change the Show setting to 'iCal Entity' (rather than 'Content' or 'Fields').
  8. In the settings for iCal Entity, select the date field that should be used
    as the event date for the iCal feed. Make sure that you choose a field that
    is a part of every entity that your View displays. Otherwise, the entities
    which don't have that field will be left out of the iCal feed.
  9. You may optionally choose a field that will be used to populate the Location
    property of events in your iCal feed. This field can be either a text field
    or a Node Reference field, in which case the title of the node will be used.
  10. Give the feed a path like 'calendar/%/export.ics', where you have a
    '/%/' for every contextual filter in the view.
  11. Make sure the Pager options are set to "Display all items".
  12. Add date filters or arguments that will constrain the view to the items you
    want to be included in the iCal feed.
  13. Attach the feed to a another view (usually a Page view that is displaying
    the same events). Be aware, though, that attaching the feed to a view with
    different output will not make the iCal feed include that output. It will
    always include the events which match the feed's filters.
  14. Save the View.
  15. Navigate to a page which displays the attached view. You should see the iCal
    icon at the bottom of the view's output. Clicking on the icon will subscribe
    your preferred calendar app the iCal feed. However, if you don't have a
    calendar app set up on your computer, you'll want to go back to the View
    settings page, click the Settings link next to "Format: iCal Feed", and check
    "Disable webcal://", then save your View. This will make the iCal icon
    download a .ics file with the events, instead of loading the events directly
    into a calendar app.

How to export an iCal feed using the iCal Fields plugin

  1. Same as above.
  2. Same as above.
  3. Same as above.
  4. Same as above.
  5. Same as above.
  6. Same as above.
  7. Add views fields for each piece of information that you want to populate your
    iCal feed with. A Date field is required, and fields that will act as the
    Title and Description of the events are recommended. You can also include a
    Location field.
  8. Back in the FORMAT section, change the Show setting to 'iCal Fields'.
  9. In the settings for iCal Fields, choose which views fields you want to use
    for the Date, Title, Description, and Location.
  10. Same as above.
  11. Same as above.
  12. Same as above.
  13. Same as above.
  14. Same as above.
  15. Same as above.

Importing iCal feeds from other sites using Feeds

  1. Install the Feeds module, which is the framework upon which Date iCal's import functionality is built.
  2. Log in to your Drupal site and navigate to the admin/structure/feeds page.
  3. Click the "Add importer" link, and give it a name and description.
  4. Clicking "Create" will bring you to the general Feeds importer settings page. This page displays some general information about making Feeds importers, which you should familiarize yourself with.
  5. In the left sidebar, you'll see "Basic settings", "Fetcher", "Parser", and "Processor". The Parser and Processor settings are what we're interested in. In the Parser section, click "change". This will bring up the Parser selection page, where you should select the radio button for "iCal Parser" and then click Save.
  6. Under Node Processor, click the "Settings" link. Most of the time, you'll want to use the "Update existing nodes (slower than replacing them)" setting. Then select the Content type of the nodes you'd like to create from iCal events. You can leave the other settings as their defeaults, or change them as you need.
  7. Click Save.
  8. Cick the "Mapping" link at the bottom of the left sidebar. This page is where you'll define how iCal event properties get mapped into your nodes' fields. Expand the "Legend" for a detailed description of each source and target field. Sources are the attributes available in iCal event objects, and Targets are the fields in your nodes.
  9. Most of this setup is going to be dependant upon how your content type's fields are configured, but there are some universal requirements:

    a) You must map the "UID" source to the "GUID" target. Then, after clicking "Add", click the gear-shaped button that appears in the new table row, and check the "Unique" checkbox. Then click "Update", and immediately click "Save" at the bottom of the page.

    c) It's a good idea to map the "Summary/Title" source to the "Title" target, and the "Description" source to whatever field is the "body" of the node.

  10. Once you've completed all the mappings, click the "Save" button on the bottom left side of the page.
  11. Now you can import the iCal feed into nodes by going to the /import page of your site (e.g. http://www.exmaple.com/import). Click the link for the importer you just created, and enter the URL of the feed you'd like to import into the "URL" field. Click the "Import" button, and observe the progress.
  12. Once it's done, you should see a green message saying "Created X nodes." If you do, you've successfully set up your iCal importer. If you get some other message, you'll need to tweak the importer's settings.

Remember, you have to map the UID source to the GUID target, and make it unique, or your imports won't work!

IMPORTANT NOTE:

If you're building a site that will be viewed by out-of-state users, and you allow said users to set their own timezone, you'll want to set up your Date fields to use the "Date's time zone" option. If you don't, then users who live in a different timezone will be shown the times for your events in their local timezone, rather than your events' timezone. This makes sense if your events will be broadcast live to these out-of-state users, but if they need to travel to your event, they may end up arriving at the wrong time.

Additional Notes

The recommended method for manipulating data from imported Cal feeds is to use the Feeds Tamper module. If Feeds Tamper isn't quite enough for your purposes, check out the date_ical.api.php file for the list of Date iCal's alter hooks. There are alter hooks there for both import and export.

The Feeds Tamper module is quite useful for manipulating the data in imported iCal feeds.

Known issues

If your site is using Organic Groups and the DESCRIPTION field is missing from your iCal feed's events, you may be experiencing a permissions issue. Please visit this link for a potential solution.

Comments

bcen_dave’s picture

I have an app (open atrium v.1) that I'd like to add an iCal feed to and this looks like a good way but seems to require v.7 of Drupal. Any plans for version 6? Can it be made to fit in any reasonable way?

Dave

coredumperror’s picture

Sorry, there are no plans for a Drupal 6 version of this module. I honestly don't know how much work would need to go into making a backport, but considering that there is a Views 3.0 for Drupal 6, it might be relatively straightforward for someone to try to do themselves. I'd be happy to incorporate a Drupal 6 version of Date iCal that someone might create.