diff --git a/plugins/date_sources/date_field.inc b/plugins/date_sources/date_field.inc index f23073cf2f5cb46df8089ccd0b6e44459d2aafde..5697fd1920937cccffd774999bfd1a7b6ff59d0c 100644 --- a/plugins/date_sources/date_field.inc +++ b/plugins/date_sources/date_field.inc @@ -27,26 +27,33 @@ function views_timelinejs_date_source_date_field_conversion($date, $output_forma $timezone = date_get_timezone($tz_handling); $db_timezone = date_get_timezone_db($tz_handling); switch ($output_format) { - case 'iso8601': + case 'iso8601':{ $ret['value'] = views_timelinejs_convert_to_iso($date['value'], $input_format, $timezone, $db_timezone); if (isset($date['value2'])) { $ret['value2'] = views_timelinejs_convert_to_iso($date['value2'], $input_format, $timezone, $db_timezone); } - return $ret; - - case 'gregorian': + break; + } + case 'gregorian':{ $ret['value'] = views_timelinejs_convert_to_gregorian($date['value'], $input_format, $timezone, $db_timezone); if (isset($date['value2'])) { $ret['value2'] = views_timelinejs_convert_to_gregorian($date['value2'], $input_format, $timezone, $db_timezone); } - return $ret; - - case 'timestamp': + break; + } + case 'timestamp':{ $ret['value'] = views_timelinejs_convert_to_timestamp($date['value'], $input_format, $timezone, $db_timezone); if (isset($date['value2'])) { $ret['value2'] = views_timelinejs_convert_to_timestamp($date['value2'], $input_format, $timezone, $db_timezone); } - return $ret; - + break; + } } + + // If times are the same, don't duplicate. + if (isset($ret['value2']) && $ret['value'] == $ret['value2']) { + unset($ret['value2']); + } + + return $ret; } diff --git a/views_timelinejs_plugin_style_timelinejs.inc b/views_timelinejs_plugin_style_timelinejs.inc index 869becc928e94fea099f4615621b05f866b80810..43f8bbdf371c424ef3ad7c7bab8e476a5e4d9b9f 100644 --- a/views_timelinejs_plugin_style_timelinejs.inc +++ b/views_timelinejs_plugin_style_timelinejs.inc @@ -291,16 +291,16 @@ class views_timelinejs_plugin_style_timelinejs extends views_plugin_style { // Body - plain text input, optionally append "read more" entity link. if ($target_field == 'text') { $v_text = strip_tags($view->style_plugin->rendered_fields[$count][$this->options['timeline_fields'][$source_field]]); - - $rows[$count][$target_field] = $v_text; - - if (isset($this->options['timeline_config']['link_text_enabled']) && $this->options['timeline_config']['link_text_enabled'] && isset($row->uri['path'])) { - $rows[$count][$target_field] .= theme('views_timelinejs_link_to_entity', - array( - 'uri' => $row->uri['path'], - 'link_text' => check_plain($link_text), - ) - ); + if ($v_text) { + $rows[$count][$target_field] = $v_text; + if (isset($this->options['timeline_config']['link_text_enabled']) && $this->options['timeline_config']['link_text_enabled'] && isset($row->uri['path'])) { + $rows[$count][$target_field] .= theme('views_timelinejs_link_to_entity', + array( + 'uri' => $row->uri['path'], + 'link_text' => check_plain($link_text), + ) + ); + } } } @@ -368,7 +368,9 @@ class views_timelinejs_plugin_style_timelinejs extends views_plugin_style { $media['formatted'] = call_user_func($conversion_callback, $value, array('field' => $tmp)); } - $rows[$count]['asset'][$target_field] = check_plain($media['formatted']); + if ($media['formatted']) { + $rows[$count]['asset'][$target_field] = check_plain($media['formatted']); + } } // Media Caption, Media Credit - both plain text. @@ -381,7 +383,9 @@ class views_timelinejs_plugin_style_timelinejs extends views_plugin_style { if (!is_string($v_text)) { $v_text = $v_text['value']; } - $rows[$count]['asset'][$target_field] = check_plain($v_text); + if ($v_text) { + $rows[$count]['asset'][$target_field] = check_plain($v_text); + } } } }