function _fullcalendar_set_display_times in FullCalendar 7
Same name and namespace in other branches
- 6.2 fullcalendar.module \_fullcalendar_set_display_times()
- 6 fullcalendar.module \_fullcalendar_set_display_times()
Translates times to the right display times.
This is done by passing times through date modules date_formatter_process function.
Parameters
$node: The node that will be updated.
$field_name: The name of the date field.
$field: The field structure for the date field.
$item: The field value for the date field.
Return value
Array of event attributes to pass to the FullCalendar plugin.
1 call to _fullcalendar_set_display_times()
- template_preprocess_views_view_node_fullcalendar in ./
fullcalendar.module - Prepares variables for template file invoked for node row type.
File
- ./
fullcalendar.module, line 308 - Provides a views style plugin for FullCalendar
Code
function _fullcalendar_set_display_times($entity_type, $entity, $field_name, $instance = NULL, $field = NULL, $item = NULL) {
if (is_array($entity->{$field_name})) {
$date = date_formatter_process(NULL, $entity_type, $entity, $field, $instance, $entity->language, $item, NULL);
$date1 = $date['value']['local']['object'];
$date2 = $date['value2']['local']['object'];
}
else {
$date1 = new DateObject($entity->{$field_name}, date_default_timezone(), DATE_FORMAT_UNIX);
$date2 = $date1;
}
return array(
'field' => $field_name,
'allDay' => date_field_all_day($field, $instance, $date1, $date2),
'start' => $date1,
'end' => $date2,
'nid' => $entity->nid,
'cn' => $entity->class,
'title' => $entity->title,
'class' => 'fullcalendar_event_details',
'editable' => $entity->editable,
);
}