function phptemplate_date_display_combination($element) { static $repeating_ids = array(); return "TEST"; $node = $element['#node']; $field_name = $element['#field_name']; $context = !empty($node->content) && !empty($node->content[$field_name]) ? $node->content[$field_name]['#context'] : 'full'; $type_name = $element['#type_name']; $fields = content_fields(); $field = $fields[$field_name]; $item = $element['#item']; // Get the formatter settings, either the default settings for this node // type or the View settings stored in $node->date_info. $options = date_formatter_get_settings($field_name, $type_name, $context); if (!empty($node->date_info) && !empty($node->date_info->formatter_settings)) { $options = $node->date_info->formatter_settings; } // If date_id is set for this field and the delta doesn't match, don't display it. if (!empty($node->date_id)) { foreach ((array) $node->date_id as $key => $id) { list($module, $nid, $field_name, $delta, $other) = explode(':', $id); if ($field_name == $field['field_name'] && isset($item['#delta']) && $delta != $item['#delta']) { return; } } } $output = ''; // Check the formatter settings to see if the repeat rule should be // displayed. Show it only with the first multiple value date. if (!in_array($node->nid, $repeating_ids) && module_exists('date_repeat') && !empty($item['rrule']) && $options['repeat']['show_repeat_rule'] == 'show') { require_once('./'. drupal_get_path('module', 'date') .'/date_repeat.inc'); $output .= theme('date_repeat_display', $field, $item, $node); $repeating_ids[] = $node->nid; } // If this is a full node or a pseudo node created by grouping // multiple values, see exactly which values are supposed to be visible. if (isset($node->$field_name)) { $node = date_prepare_node($node, $field, $type_name, $context, $options); // Did the current value get removed by formatter settings? if (empty($node->{$field_name}[$item['#delta']])) { return $output; } // Adjust the $element values to match the changes. $element['#node'] = $node; } // Call the right theme for this formatter. // Update the element with values that might have been altered by // date_prepare_node() and figure out which values to display. $dates = date_formatter_process($element); switch ($options['fromto']['fromto']) { case 'value': $date1 = $dates['value']['formatted']; $date2 = $date1; break; case 'value2': $date2 = $dates['value2']['formatted']; $date1 = $date2; break; default: $date1 = $dates['value']['formatted']; $date2 = $dates['value2']['formatted']; break; } // Pull the timezone, if any, out of the formatted result and tack it // back on at the end, if it is in the current formatted date. $timezone = $dates['value']['formatted_timezone']; if ($timezone) { $timezone = ' ' . $timezone; } $date1 = str_replace($timezone, '', $date1); $date2 = str_replace($timezone, '', $date2); // No date values, display nothing. if (empty($date1) && empty($date2)) { $output .= ''; } // From and To dates match or there is no To date, display a complete single date. elseif ($date1 == $date2 || empty($date2)) { $output .= theme('date_display_single', $date1, $timezone); } // Same day, different times, don't repeat the date but show both From and To times. elseif (date_has_time($field['granularity']) && $dates['value']['formatted_date'] == $dates['value2']['formatted_date']) { // Replace the original time with the from/to time in the formatted start date. // Make sure that parentheses or brackets wrapping the time will be retained in the // final result. $time1 = preg_replace('`^([\(\[])`', '', $dates['value']['formatted_time']); $time1 = preg_replace('([\)\]]$)', '', $time1); $time2 = preg_replace('`^([\(\[])`', '', $dates['value2']['formatted_time']); $time2 = preg_replace('([\)\]]$)', '', $time2); $time = theme('date_display_range', $time1, $time2); $replaced = str_replace($time1, $time, $date1); $output .= theme('date_display_single', $replaced, $timezone); } // Different days, display both in their entirety. else { $output .= theme('date_display_range', $date1, $date2, $timezone); } return $output; }