function wsfields_wsfields_data_alter in Web Service Data 7
Implements hook_wsfields_data_alter().
File
- modules/
wsfields/ wsfields.module, line 25 - Defines core functionality for web service powered fields
Code
function wsfields_wsfields_data_alter($data, $field) {
// Ensure the data is keyed by language if translatable
if (!empty($field['translatable'])) {
$languages = language_list();
}
else {
$languages = array(
LANGUAGE_NONE => LANGUAGE_NONE,
);
$data = array(
LANGUAGE_NONE => $data,
);
}
foreach ($languages as $lang => $language) {
if (!is_array($data[$lang])) {
$data[$lang] = array(
$data[$lang],
);
}
}
return $data;
}