Each event for which colors are enabled should have CSS classes added per-taxonomy term, per-node type, and per-group, probably something like:

  • .node-type-[machine_name] for node types
  • .taxonomy-term-[tid] for taxonomy terms
  • .group-[gid] for groups

For reference, here's the theme function for fullcalendar_classname (which gives classes to an individual event):

<?
/**
* Constructs CSS classes for a entity.
*
* @param $node
* An object representing the entity.
*
* @return
* A string suitable for use as a CSS class.
*/
function theme_fullcalendar_classname($variables) {
$entity = $variables['entity'];
$className = array(
'fc-event-default',
$entity->bundle,
);
return implode(' ', $className);
}
?>

Oh, and to tim.plunkett: Yes, installing a site with drush is oh-so-much better than doing things by hand!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

aspilicious’s picture

After talking to Tim, I made a hook we can use :).
The patch for that will be pushed soon: http://drupal.org/node/1131028

After that one is in, we need to implement the hook (something like this)

/**
 * Implements hook_fullcalendar_classname.
 */
function fullcalendar_colors_fullcalendar_classname($entity) {
  $className = array(
    'a custom className',
    'another one',
  );
  return $className;
}
aspilicious’s picture

I made a prototype hook implementation to proove it is working.
We need more discussion about how we ware going to handle this.

Option 1
--------
Leave as it is and throw everything in the hook

Option 2
-------
Make a css color function for each type:
Something like this.

function _node_type_create_css($entity) { 
  $css = '';
  return $css;
}

This option leaves the add css call in the hook

Option 3
--------
Same as 2 but it does almost everything that is happening in the hook at the moment, it will return an array of classes that needs to be merged with the classes from other types.

Option 4
---------
??? feel free to fill in

aspilicious’s picture

Status: Active » Needs review
geerlingguy’s picture

I like option 2, as it seems to be the most maintainable/modularized (as we will hopefully add more entity types in the future, perhaps... like commerce products, etc.).

geerlingguy’s picture

Status: Needs review » Fixed

This was all fixed over in #1130092: Fixed farbtastic stuff.

tim.plunkett’s picture

Project: » FullCalendar
Version: » 7.x-2.x-dev
Component: Code » FullCalendar Colors

Status: Fixed » Closed (fixed)

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