You are here

function _ws_datefield_map_datetime in Web Service Data 7

Map the data values to their address field containers

Maps values to the following array keys: schedule

@params array $data @params array $field

1 call to _ws_datefield_map_datetime()
ws_datefield_wsfields_datetime_data_alter in modules/ws_datefield/ws_datefield.module
Implements hook_wsfields_FIELD_TYPE_data_alter().

File

modules/ws_datefield/ws_datefield.module, line 116
Main module for ws_datefields

Code

function _ws_datefield_map_datetime(&$data, $field) {
  $field_data = array();
  if (isset($data['schedule']['vevents'])) {
    $dates = $data['schedule']['vevents'];
    foreach ($dates as $k => $v) {
      $value = array(
        'value' => new DateTime($v['start_datetime']),
        'value2' => new DateTime($v['end_datetime']),
      );
      if (isset($v['repeat']) && isset($v['exceptions'])) {
        $value['rrule'] = $v['repeat'] . sizeof($v['exceptions']) > 0 ? 'exceptions=' . implode(',', $v['exceptions']) : '';
      }
      _ws_datefield_populate_datetime_field_data($field_data, $value, true, true);
    }
  }
  return $field_data;
}