You are here

function _fullcalendar_set_display_times in FullCalendar 6

Same name and namespace in other branches
  1. 6.2 fullcalendar.module \_fullcalendar_set_display_times()
  2. 7 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 289
Provides a views style plugin for FullCalendar

Code

function _fullcalendar_set_display_times($node, $field_name, $field = NULL, $item = NULL) {
  if (is_array($node->{$field_name})) {
    $dfp_info = array(
      '#node' => $node,
      '#field_name' => $field_name,
      '#formatter' => NULL,
      '#item' => $item,
    );
    $date = date_formatter_process($dfp_info);
    $date1 = $date['value']['local']['object'];
    $date2 = $date['value2']['local']['object'];
  }
  else {
    $date1 = date_make_date($node->{$field_name}, date_default_timezone(), DATE_UNIX);
    $date2 = $date1;
  }
  return array(
    'field' => $field_name,
    'allDay' => date_field_all_day($field, $date1, $date2),
    'start' => $date1,
    'end' => $date2,
    'nid' => $node->nid,
    'cn' => $node->class,
    'title' => $node->title,
    'class' => 'fullcalendar_event_details',
    'editable' => $node->editable,
  );
}