Closed (outdated)
Project:
FullCalendar
Version:
8.x-1.x-dev
Component:
User interface
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
16 Oct 2017 at 17:06 UTC
Updated:
5 Jun 2025 at 14:21 UTC
Jump to comment: Most recent
Comments
Comment #2
david.qdoscc commentedI would like to see this functionality too.
Comment #3
lor commentedI'm really interested too!
Any way?
ThanX!
Comment #4
tacituseu commentedTwo ways:
- help porting https://www.drupal.org/project/colors and Fullcalendar Colors submodule to D8
- use
hook_fullcalendar_classes()andhook_fullcalendar_classes_alter()which provides$entityas contextComment #5
ryankavalsky commentedIf anybody's interested, I've used hook_fullcalendar_classes_alter() to add classes to events based on event information. My code is integrating FullCalendar with Recurring Events, so I've taken out some of the code specific to that interaction.
Then, on the CSS side, it's as simple as setting your rules. I plan on using this more for CSS-only tooltips and before/after icons than color-coding events.
Comment #6
kazah commented@ryankavalsky,
Do you replace
$entityinfunction [custom_module_name]_fullcalendar_classes_alter(&$classes, $entity) {with$node?I can't make it work...
Comment #7
ryankavalsky commentedHi @kazah, I am still using $entity in the noted function call:
Comment #8
kazah commentedThank you!
Could you please provide more code here
// Determine some information about this eventI try to use this code to add classes to my events based on my field "status" with options:
But couldn't understand how to do it...maybe your example helps me.
Thank you in advance.
Comment #9
ryankavalsky commentedHi @kazah,
I've included a little more of the code below, leaving out anything proprietary though. You can probably use $entity->get("status")->value to determine your events' status and work from there.
Hope this helps!
Comment #10
kazah commentedI couldn't get it to work...maybe because my site on drupal 9, or maybe because I use webform submissions.
I really appreciate your help! Thank you!
Comment #11
joshuautley commentedHow about simply adding non-specific classes to print such as; .tax1, .tax2, etc with the class name related to the number of taxonomy terms based on their order in the vocabulary?
In the example below I've placed the "tax1" class in the tag which would allow me to target it and all tags within so I could have a yellow background with black text.
<td class="fc-event-container"><a class="fc-day-grid-event fc-h-event fc-event fc-start fc-end fc-draggable tax1" href="/event/some-event-name" style="background-color:#ffff00"><div class="fc-content"><span class="fc-time">07:00 am</span> <span class="fc-title">SOME EVENT NAME</span></div></a></td>Currently, I can not have dark and light color backgrounds because the text color can not be easily altered without a custom module.
Comment #12
dcam commentedClosing this as outdated since
hook_fullcalendar_classes()andhook_fullcalendar_classes_alter()exist.