2

I'm working on the content design for a new site, but I'm having a major hangup with some of the connections between the data types, especially when it comes to Dates and Calendars. Here's the rundown:

  • Films share a many to many relationship with Programs.
  • Programs can have one or many Screenings.
  • Screenings each have one Date and Venue.

I've successfully accomplished this using Node Reference and Field Collection. There is a node reference between Films and Programs. Programs contains a field collection called Screenings. The field collection Screenings contains the fields Date and Venue.

The functionality I love from this setup is that each Date and Venue pair is grouped, and I can just click the Add button to generate another pair within that Program. This satisfies the one or many requirement for Screenings.

Unfortunately, when I start to build this all into a Calendar view (Date module, Calendar module), it breaks terribly. Depending on how I set things, I end up with SQL errors or index errors within Drupal. None of it works. Reading through issue posts, I've gathered that this is probably some sort of complexity added by Field Collection which is not handled in Calendar.

Short of getting Field Collection to play nice with Date and Calendar, can anyone suggest another method for implementing this? My next thought would be to move Screenings off into its own node and create another node reference between that and Programs. However, that would mean I lose the clean and simple Add button to generate a new Screening within a program.

Perhaps a custom add/edit form is all I really need. Unfortunately, that road seems rather perilous for me without some clear guidance.

  • These are threads that I came across, but haven't helped with a solution yet: drupal.org/node/1211842 drupal.org/node/1047784 – Pete Nov 17 '11 at 4:19
  • Update: after getting all the latest dev versions (as of 2011-11-16), I'm no longer getting errors on my calendar view. But I'm not getting Programs, either. I've added "Field: Date" (from field collection Screening) to my contextual filters in the view, but I'm not getting anything. Default value is current date, granularity is Month, added multiplier value, comparing by start/end range... Hopefully someone else sees what I'm missing... – Pete Nov 17 '11 at 5:36
4

I couldn't get Calendar to play nice with Field Collections. It seems like I needed to somehow provide for the custom calendar row plugin or calendar items within the field collection view (it's too complicated).

Ultimately, I went with the FullCalendar module, which is built on the FullCalendar jQuery plugin.

It's very clean, simple to setup, and it plays very nicely with everything I'm throwing at it. If Calendar and Field Collections make any further progress with their development, I might revisit them, but for now this fits the bill.

1

I was up against this exact problem, but kept banging away at it until I figured it out.

It doesn't work by default because views is looking for nodes, and fields in field collections aren't recognized as part of a node. You need to be very explicit with views as to where to find the date field.

  1. Install Field Collection Views module, which will create a "field collection views" view. Clone that, don't edit it directly in case you need to come back to it.
  2. Change the format to Calendar
  3. Create a relationship to the entity that contains the field collection items
  4. Create a contextual filter for the date field in your field collection
  5. create contextual filters for other fields in the content type with the field collection
  6. add those fields to the field section.

It was complicated and took me hours to figure out. I gave up several times. I stayed up way too late. I THINK I have outlined all the steps. Hopefully it will help someone a little bit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.