function ga_push_push_data_mapper in GA Push 7
Same name and namespace in other branches
- 8 ga_push.module \ga_push_push_data_mapper()
Helper function to translate data keys.
Parameters
array $key_map: Array with keys to translate.
array $data: Data push array.
bool $initialize_empty: Initialize empty values.
Return value
array Mapped data.
1 call to ga_push_push_data_mapper()
- ga_push_add_legacy_params in ./
ga_push.module - Maps old method keys to the new ones. This function is for legacy compatibility and will be removed on next releases.
File
- ./
ga_push.module, line 939 - Drupal Module: GA Push.
Code
function ga_push_push_data_mapper($key_map, $data, $initialize_empty = FALSE) {
$mapped_data = array();
foreach ($data as $key => $value) {
$mkey = isset($key_map[$key]) ? $key_map[$key] : $key;
$mapped_data[$mkey] = $value;
}
if ($initialize_empty) {
$mapped_data += array_fill_keys($key_map, '');
}
return $mapped_data;
}