Commit 950c8f6e authored by Eric Bremner's avatar Eric Bremner
Browse files

ISTWCMS-2562: Ensuring that timezone and timezonedb are added to the field when a repeating date

parent f6f09e20
......@@ -71,18 +71,25 @@ function uw_ct_event_preprocess_node(&$vars) {
// Display settings for the field_event_date.
$display = array('settings' => array('format_type' => 'hours_change_format'), 'label' => 'hidden');
// Get the entity wrapper for the individual event node.
// This is required to get the timezone.
$event_wrapper = entity_metadata_wrapper('node', $vars['view']->result[$vars['id'] - 1]->nid);
// Replace the two date values from the view results
// into the 0th element of field_event_date.
// Also, add in the timezone.
'value' => $vars['view']->result[$vars['id'] - 1]->field_data_field_event_date_field_event_date_value,
'value2' => $vars['view']->result[$vars['id'] - 1]->field_data_field_event_date_field_event_date_value2,
'timezone' => $event_wrapper->field_event_date->value()[0]['timezone'],
'timezone_db' => $event_wrapper->field_event_date->value()[0]['timezone_db'],
// Get the field_event_date from the node.
$field_event_date = field_get_items('node', $node, 'field_event_date');
// Set the new output from the re-occured dates.
$vars['content']['output'] = field_view_value('node', $node, $field_name, $field_event_date[$vars['id'] - 1], $display);
$vars['content']['output'] = field_view_value('node', $node, $field_name, $field_event_date[0], $display);
// Drop the re-occuring rule if it is present.
$vars['content']['output']['#markup'] = preg_replace('/\<div class=\"date-repeat-rule\"\>(.*?)\<\/div\>/', '', $vars['content']['output']['#markup']);
Supports Markdown
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