I have summarized UK_Rogue and aspilicious's posts below and suggest to update the part of the handbook that describes event coloring for Drupal 6.

Event Coloring

Drupal6

To apply specific colors to event types in Full Calendar we use taxonomy terms that correspond to the event types. Follow the steps below to implement event coloring for Drupal6:

1) Create your taxonomy terms and link them to your event content type. Note that the term names are not important as we will be using the term ID only.

2) Put this code into a custom module to create a class for each taxonomy term.

<?php
/**
* Implementation of hook_fullcalendar_classes().
*
* @param $node
*   An object representing the node.
*
* @return
*   A string suitable for use as a CSS class.
*/
function [myModuleName]_fullcalendar_classes($node) {
  $classes= array();

  // Taxonomy Term IDs for coloring
  foreach ($node->taxonomy as $term_id) {
    $classes[] = 'fc-event-tid-' . $term_id->tid;
  }
  return implode(' ', $classes);
}
?>

3) Add the appropriate definitions to your css file. Below is an example for three different event types:

.fc-event-tid-1,
.fc-event-tid-1 .fc-event-skin,
.fc-event-tid-1 .fc-event-time,
.fc-event-tid-1 a {
color: #fff;
background-color: #ff4500;
}
.fc-event-tid-2,
.fc-event-tid-2 .fc-event-skin,
.fc-event-tid-2 .fc-event-time,
.fc-event-tid-2 a {
color: #fff;
background-color: #87cefa;
}
.fc-event-tid-3,
.fc-event-tid-3 .fc-event-skin,
.fc-event-tid-3 .fc-event-time,
.fc-event-tid-3 a {
color: #fff;
background-color: #32cd32;
}

4) Flush caches and refresh your browser and you are done.

Comments

tim.plunkett’s picture

Version: 6.x-2.0-alpha1 » 6.x-2.x-dev
Status: Active » Needs review

Thanks! Either aspilicious or I will review and make the changes.

aspilicious’s picture

Status: Needs review » Fixed

I fixed the documentation, I changed 2 words I think. I also restructured the documentation because it's getting big (which is good :D).

I added an API page feel free to help us explain what developers can do with hook_fullcalendar_classes (drupal 6 or drupal 7).

wernerglinka’s picture

@aspilicious , sorry for the late response I have been busy with deadlines. What are you thinking of? An api page for hook_fullcalendar_classes? I can put one together this weekend.

aspilicious’s picture

Yes I added an empty page alrdy. We have to:

- Explain how to implement the hook
- Explain what it does

:)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

wernerglinka’s picture

Status: Closed (fixed) » Active

Hi aspilicious,
Is this what you are looking for?

hook_fullcalendar_classes

Drupal 6

Versions
6 hook_admin_paths()

Define additional classes to style event types in Full Calendar .

Return value

A string with classes to be added to Full Calendar events.

See also

anything to add here?

Related topics

anything to add here?

Code

sites/all/modules/contrib/fullcalendar/fullcalendar.module, line 130

/**
 * Implements hook_fullcalendar_classes().
 */
function fullcalendar_fullcalendar_classes($node) {
  $classes = array(
    'fc-event-default',
    $node->type,
  );
	
	return $classes;
}
aspilicious’s picture

It's a start I'm going to work on this in a few weeks. Would like to add that it *adds* classes so it doens't overwrite classes.
Thats why we have the alter.

Thnx for the input

wernerglinka’s picture

@aspilicious - It says "additional" and "to be added" that should clearly convey the message that one adds classes.
Let me know if I can help further.
Werner

aspilicious’s picture

Status: Active » Closed (fixed)

Marking this fixed.