Commit c6edda47 authored by Eric Bremner's avatar Eric Bremner
Browse files

ISTWCMS-2562: Fixing repeating events that extending over multiple days

parent 950c8f6e
......@@ -69,7 +69,7 @@ function uw_ct_event_preprocess_node(&$vars) {
if (count($wrapper->field_event_date->value()) > 1 || count($wrapper->field_event_date->value()) == 0) {
// Display settings for the field_event_date.
$display = array('settings' => array('format_type' => 'hours_change_format'), 'label' => 'hidden');
$display = array('settings' => array('format_type' => 'long'), 'label' => 'hidden');
// Get the entity wrapper for the individual event node.
// This is required to get the timezone.
......@@ -78,21 +78,24 @@ function uw_ct_event_preprocess_node(&$vars) {
// Replace the two date values from the view results
// into the 0th element of field_event_date.
// Also, add in the timezone.
$wrapper->field_event_date[0]->set(array(
$event_date = array(
'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[0], $display);
$vars['content']['output'] = field_view_value('node', $node, $field_name, $event_date, $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']);
// Remove the second end date if over multiple dates.
$vars['content']['output']['#markup'] = preg_replace('/ to <span.*?<\/span>/', '', $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