1 date.theme.inc | theme_date_display_interval($variables) |
Returns HTML for a date element formatted as an interval.
Related topics
File
- core/
modules/ date/ date.theme.inc, line 364 - Theme and preprocess functions for output by Date module.
Code
function theme_date_display_interval($variables) {
$entity = $variables['entity'];
$options = $variables['display']['settings'];
$dates = $variables['dates'];
$attributes = $variables['attributes'];
// Get the formatter settings, either the default settings for this node type
// or the View settings stored in $entity->date_info.
if (!empty($entity->date_info) && !empty($entity->date_info->formatter_settings)) {
$options = $entity->date_info->formatter_settings;
}
$time_ago_vars = array(
'start_date' => $dates['value']['local']['object'],
'end_date' => $dates['value2']['local']['object'],
'interval' => $options['interval'],
'interval_display' => $options['interval_display'],
);
if ($return = theme('date_time_ago', $time_ago_vars)) {
return '<span class="date-display-interval"' . backdrop_attributes($attributes) . ">$return</span>";
}
else {
return '';
}
}