Hello there,

I have a an entity that has many date fields eg. Project start date, client meeting date etc etc. These all display on the calendar however when ever a date occurs the view shows every possible date entered for that entity.

I've attached an image as I'm probably not making much sense. Is there a way of only showing the relevant date per day? Eg the Client meeting date on the correct day without all the other fields...

CommentFileSizeAuthor
Screenshot.png82.54 KBtr33m4n
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

arlinsandbulte’s picture

So, each calendar entry is showing all date fields?
If so, you just need to edit the fields display in views to no include the fields you don't want to see.

tr33m4n’s picture

But then the fields that aren't displayed would not show on the dates they appear surely?

arlinsandbulte’s picture

Hmmm, I think I understand your use case.
Your nodes (or entities) represent a project with multiple date fields for different milestones of that project.
Calendar is configured to use each date field on the node (or entity) to show a sort of timeline of that project.
But, each time the node (or entity) is shown on the calendar, all date fields used are displayed. You only want the specific field for that particular date instance displayed.

I don't think what you want is natively possible with the calendar module, but it might make an interesting feature request.

A couple thoughts that might lead to a quick solution:

  1. Use the rewrite field display option and some custom code to hide the non-relevant date fields.
  2. Split the project node up into multiple nodes and use node references. Thus, you would have a single parent project node with other event sub-nodes related to the parent node using a reference. Each sub-node would contain a single date field for the event or milestone. Then, the sub-nodes would be displayed on the calendar. Relationships could be used if you need to pull in information from the parent node for display on the calendar too.

I think option #2 would be pretty easy to implement, AND provide some very nice workflow features if I understand your use case properly.

tr33m4n’s picture

Yes, that's exactly what I want to achieve.

Any idea how to achieve number one on your list? I don't think number two would be possible due to the sheer amount of fields each node has.

I have a views display on the other end of things displaying nodes kind of like a spreadsheet with editable fields... Trying to do number two would possibly start damaging performance on that end as well :S

Thanks for the suggestions
Dan

tr33m4n’s picture

Category: support » feature
johnv’s picture

I have the exact request, and it works fine (on a month display). I have 3 date fields in a Node type.
- in contextual filters, I define 1 date field
- in Fields, I add 3 date fields and 2 other fields - every field shows in de Entity/Event
- in Fields, when I 'exclude' a date field or a normal field, the field do not show up in the Event.

arlinsandbulte’s picture

johnv: tr33m4n wants to conditionally hide the fields not used to 'place' the node in the calendar view. I think that is different from what you describe.

Example:
A 'Project' Node type has 3 date fields (for example, node title = 'Project #1').
Date field #1 is project approved (for example, July 1, 2012).
Date field #2 is project started (for example, July 5, 2012).
Date field #3 is project ended (for example, July 10, 2012).
The Calendar view is configured to use all three date fields to place the project nodes on the calendar grid.
When our example node is placed on the calendar, it will show up 3 times on July 1, 5, & 10.
Each time it shows up, all three fields are shown:

July 1:
- Project #1
-- Approved - July 1, 2012
-- Started - July 5, 2012
-- Ended - July 10, 2012
July 5:
- Project #1
-- Approved - July 1, 2012
-- Started - July 5, 2012
-- Ended - July 10, 2012
July 10:
- Project #1
-- Approved - July 1, 2012
-- Started - July 5, 2012
-- Ended - July 10, 2012

This can be a bit confusing in this use case.

tr33m4n wants this:

July 1:
- Project #1
-- Approved - July 1, 2012
July 5:
- Project #1
-- Started - July 5, 2012
July 10:
- Project #1
-- Ended - July 10, 2012
johnv’s picture

Ok, Hmmm, now I think I understand your use case, too :-).

If I may throw in a suggestion/workaround:
- as a workaround, you can use the Legend/Striping. Hide the fields (which are not necessary, unless you have hours), and set a striping color.
- as a long-term solution: The theming (also in striping/legend?) can be extended. Some other issues try to set the background, this issue sets a text.

arlinsandbulte’s picture

@#4 tr33m4n:
I have no idea how to do #1. Not even sure if it is possible... it was just a thought that might spark an idea in you or someone else.

Actually, I think my method 2 in comment #3 above could actually be a more robust and even better performing method.
In your original method, each project node has lots of different date fields.
In my #2 proposal, each project node has NO date fields. Each milestone sub-node as a SINGLE date field & a SINGLE node reference field.

I can think of a few ways to configure milestone sub-nodes:
1.) Sub-nodes have only title & date fields (no body, etc.) Users use the sub-node title to indicate the type of milestone event (Client Brief Meeting, Cost Estimate Provided, Further Information, etc.) This provides LOTS of flexibility for the type of dates you can add to your project, but maybe you don't want that...
or
2.) Add a taxonomy vocabulary to the sub-node to restrict the type of milestone event. Title becomes meaningless in this case (you could use Automatic Node Titles or Automatic Entity Label to hide the title).

Adding milestones to your project could be accomplished in a very similar way to Jeff Eaton's image gallery example, but using a date field instead of an image field.

The calendar view would just display the milestone sub-nodes, probably with some relationships defined to also pull in project information (like project title).

I'm not sure about how to handle your "views display on the other end of things displaying nodes kind of like a spreadsheet with editable fields..." For simple display, a view with some added relationships should work well. But, it sounds like you might be using editablefields in there too. I think that could still be made to work without much or any coding work, but I am not very familiar with editablefields.
It might also depend on your required or desired workflow needs.

tr33m4n’s picture

@ arlinsandbulte,

Thank you for your suggestions, I will try some of these and see what the outcome is... Will get back to you and post a working solution

Cheers
Dan

Fred E’s picture

I'm just encountering this same issue. Did you find a way to work around this?

Neslee Canil Pinto’s picture

Issue summary: View changes
Status: Active » Closed (outdated)