Commit 5429bb9d authored by John Franklin's avatar John Franklin

Issue #2267721 by John Franklin: Add Taxonomy Term and Node Reference support...

Issue #2267721 by John Franklin: Add Taxonomy Term and Node Reference support to the iCal Entity Views plugin LOCATION field
parent 77420106
......@@ -281,7 +281,7 @@ function date_ical_feeds_set_rrule($source, $entity, $target, $repeat_rule) {
module_load_include('inc', 'date_ical', 'date_ical.utils');
// This "loop" is really just to make sure we get the right array keys. It
// souldn't ever execute more than once.
// shouldn't ever execute more than once.
foreach ($entity->{$field_name} as $lang => $date_values) {
$values = _date_ical_get_repeat_dates($field_name, $repeat_data, $date_values[0], $source);
foreach ($values as $key => $value) {
......@@ -348,7 +348,9 @@ function _date_ical_get_location_fields($base = 'node') {
'text_with_summary',
'node_reference',
'addressfield',
'location'
'location',
'node_reference',
'taxonomy_term_reference',
);
if (!$info || !in_array($info['type'], $supported_location_fields)) {
continue;
......
......@@ -284,6 +284,24 @@ class date_ical_plugin_row_ical_entity extends views_plugin_row {
}
$location = implode(', ', $location_data);
}
elseif ($location_info['type'] == 'node_reference') {
// Make sure this Node Reference actually references a node.
if ($location_field['nid']) {
$node = node_load($location_field['nid']);
$location = $node->title;
}
}
elseif ($location_info['type'] == 'taxonomy_term_reference') {
$terms = taxonomy_term_load_multiple(array_column($items,'tid'));
// Make sure that there are terms that were loaded.
if ($terms) {
$term_names = array();
foreach ($terms as $term) {
$term_names[] = $term->name;
}
$location = implode(', ', $term_names);
}
}
else {
$location = $location_field['value'];
}
......@@ -314,7 +332,7 @@ class date_ical_plugin_row_ical_entity extends views_plugin_row {
}
}
elseif ($summary_info['type'] == 'taxonomy_term_reference') {
$terms = taxonomy_term_load_multiple($items);
$terms = taxonomy_term_load_multiple(array_column($items,'tid'));
// Make sure that there are terms that were loaded.
if ($terms) {
$term_names = array();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment