function calendar_plugin_row::calendar_taxonomy_stripe in Calendar 7.3
Create a stripe based on a taxonomy term.
1 call to calendar_plugin_row::calendar_taxonomy_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 640 - 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_taxonomy_stripe(&$result) {
$colors = isset($this->options['colors']['calendar_colors_taxonomy']) ? $this->options['colors']['calendar_colors_taxonomy'] : array();
if (empty($colors)) {
return;
}
$term_field_name = 'field_' . $this->options['colors']['taxonomy_field'];
$terms = $result->row->{$term_field_name};
foreach ($terms as $term_key => $term_value) {
$term = $term_value['raw']['taxonomy_term'];
if (!array_key_exists($term->tid, $colors) || $colors[$term->tid] == CALENDAR_EMPTY_STRIPE) {
continue;
}
$result->stripe[] = $colors[$term->tid];
$result->stripe_label[] = $term->name;
}
return;
}