You are here

function calendar_node_stripe in Calendar 5.2

Same name and namespace in other branches
  1. 5 calendar.module \calendar_node_stripe()
  2. 6.2 calendar.module \calendar_node_stripe()
  3. 7 calendar.module \calendar_node_stripe()
  4. 7.2 calendar.module \calendar_node_stripe()

Create a stripe.

Parameters

$node - the node object:

$query_name - the views queryname for this date field:

$delta - the delta for this field, used to distinguish fields that appear more than once in the calendar:

$stripe - the hex code for this stripe.:

$label - the label to give this stripe.:

TODO this is still too hard-wired to node types. Come back later and make it possible to use taxonomy terms or other values as stripe keys.

TODO Need to add in hook so ical and other modules can add things to the legend.

TODO Reconsider use of $GLOBALS as a method of triggering the legend, there may be a better way.

1 call to calendar_node_stripe()
calendar_build_nodes in ./calendar.inc
Take the array of items and alter it to an array of calendar nodes that the theme can handle.

File

./calendar.module, line 762
Adds calendar filtering and displays to Views.

Code

function calendar_node_stripe($view, &$node, $query_name, $delta, $stripe = NULL, $label = '') {
  $type_names = node_get_types('names');
  $colors = variable_get('calendar_color_' . $view->name, array());
  if (!$label) {
    $label = $type_names[$node->type];
  }
  if (!$stripe) {
    if (array_key_exists($node->type, $colors)) {
      $stripe = $colors[$node->type];
    }
    else {
      $stripe = '';
    }
  }
  $node->stripe = $stripe;
  $node->stripe_label = $label;
  $GLOBALS['calendar_stripe_labels'][$node->type] = array(
    'stripe' => $stripe,
    'label' => $label,
  );
  return $stripe;
}