function theme_date_all_day in Date 7
Same name and namespace in other branches
- 8 date_all_day/date_all_day.module \theme_date_all_day()
- 5.2 date/date.theme \theme_date_all_day()
- 6.2 date/date.theme \theme_date_all_day()
- 7.3 date_all_day/date_all_day.module \theme_date_all_day()
- 7.2 date_all_day/date_all_day.module \theme_date_all_day()
Adjust from/to date format to account for 'all day' .
Parameters
array $field, the field definition for this date field.:
string $which, which value to return, 'date1' or 'date2' .:
object $date1, a date/time object for the 'from' date.:
object $date2, a date/time object for the 'to' date.:
string $format:
object $entity, the node this date comes from (may be incomplete, always contains nid).:
object $view, the view this node comes from, if applicable.:
Return value
formatted date.
1 theme call to theme_date_all_day()
- date_formatter_process in ./
date.module - Helper function for creating formatted date arrays from a formatter.
File
- ./
date.theme, line 241 - Theme functions.
Code
function theme_date_all_day($vars) {
$field = $vars['field'];
$instance = $vars['instance'];
$which = $vars['which'];
$date1 = $vars['date1'];
$date2 = $vars['date2'];
$format = $vars['format'];
$entity = $vars['entity'];
$view = !empty($vars['view']) ? $vars['view'] : NULL;
if (empty($date1) || !is_object($date1) || $format == 'format_interval') {
return;
}
if (empty($date2)) {
$date2 = $date1;
}
if (!date_has_time($field['settings']['granularity'])) {
$format = date_limit_format($format, array(
'year',
'month',
'day',
));
return date_format_date(${$which}, 'custom', $format);
}
if ($all_day = date_field_all_day($field, $instance, $date1, $date2)) {
$format = date_limit_format($format, array(
'year',
'month',
'day',
));
return trim(date_format_date(${$which}, 'custom', $format) . ' ' . theme('date_all_day_label'));
}
else {
return date_format_date(${$which}, 'custom', $format);
}
}