You are here

function calendar_plugin_row::calendar_node_type_stripe in Calendar 7.3

Create a stripe base on node type.

1 call to calendar_plugin_row::calendar_node_type_stripe()
calendar_plugin_row::render in includes/calendar_plugin_row.inc
Render a row object. This usually passes through to a theme template of some form, but not always.

File

includes/calendar_plugin_row.inc, line 610
Contains the Calendar row style plugin.

Class

calendar_plugin_row
Plugin which creates a view on the resulting object and formats it as a Calendar node.

Code

function calendar_node_type_stripe(&$result) {
  $colors = isset($this->options['colors']['calendar_colors_type']) ? $this->options['colors']['calendar_colors_type'] : array();
  if (empty($colors)) {
    return;
  }
  $entity = $result->entity;
  if (empty($entity->type)) {
    return;
  }
  $type_names = node_type_get_names();
  $type = $entity->type;
  $label = '';
  $stripe = '';
  if (array_key_exists($type, $type_names) || $colors[$type] == CALENDAR_EMPTY_STRIPE) {
    $label = $type_names[$type];
  }
  if (array_key_exists($type, $colors)) {
    $stripe = $colors[$type];
  }
  $result->stripe[] = $stripe;
  $result->stripe_label[] = $label;
  return;
}