You are here

function _wsfields_general_data_alter in Web Service Data 7

General data alter function for fields

Fields which have a basic field format can use this to properly build out their field instance arrays

Parameters

array $data [reference]: Data array

array $field [reference]: Field instance

array $field [optionstal]: Field settings

10 calls to _wsfields_general_data_alter()
wsfields_wsfields_list_boolean_data_alter in modules/wsfields/wsfields.module
Implements hook_wsfields_FIELD_TYPE_data_alter().
wsfields_wsfields_list_float_data_alter in modules/wsfields/wsfields.module
Implements hook_wsfields_FIELD_TYPE_data_alter().
wsfields_wsfields_list_integer_data_alter in modules/wsfields/wsfields.module
Implements hook_wsfields_FIELD_TYPE_data_alter().
wsfields_wsfields_list_text_data_alter in modules/wsfields/wsfields.module
Implements hook_wsfields_FIELD_TYPE_data_alter().
wsfields_wsfields_number_decimal_data_alter in modules/wsfields/wsfields.module
Implements hook_wsfields_FIELD_TYPE_data_alter().

... See full list

File

modules/wsfields/wsfields.module, line 199
Defines core functionality for web service powered fields

Code

function _wsfields_general_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] = array(
        'value' => $lang_data,
      );
    }
  }
  $data = $field_data;
}