You are here

function ws_addressfield_wsfields_addressfield_data_alter in Web Service Data 7

Implements hook_wsfields_FIELD_TYPE_data_alter().

File

modules/ws_addressfield/ws_addressfield.module, line 13
Add support for addressfield to be used with web service fields

Code

function ws_addressfield_wsfields_addressfield_data_alter($data, $field) {
  $field_data = array();
  if (!empty($field['translatable'])) {
    $languages = language_list();
  }
  else {
    $languages = array(
      LANGUAGE_NONE => LANGUAGE_NONE,
    );
  }
  foreach ($languages as $lang => $language) {
    foreach ($data[$lang] as $key => $lang_data) {
      $field_data[$lang][$key] = _ws_addressfield_map_address($lang_data);
    }
  }
  $data = $field_data;

  // Save the new field data
  return $data;
}